public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Michal Wilczynski <michal.wilczynski@intel.com>
Cc: netdev@vger.kernel.org, alexandr.lobakin@intel.com,
	jacob.e.keller@intel.com, jesse.brandeburg@intel.com,
	przemyslaw.kitszel@intel.com, anthony.l.nguyen@intel.com,
	kuba@kernel.org, ecree.xilinx@gmail.com
Subject: Re: [PATCH net-next v8 1/9] devlink: Introduce new parameter 'tx_priority' to devlink-rate
Date: Mon, 31 Oct 2022 11:13:09 +0100	[thread overview]
Message-ID: <Y1+ftW7vmzJlg48+@nanopsycho> (raw)
In-Reply-To: <20221028105143.3517280-2-michal.wilczynski@intel.com>

Fri, Oct 28, 2022 at 12:51:35PM CEST, michal.wilczynski@intel.com wrote:
>To fully utilize offload capabilities of Intel 100G card QoS capabilities
>new parameter 'tx_priority' needs to be introduced. This parameter allows

It is highly confusing to call this "parameter". Devlink parameters are
totally different thing. This is just another netlink attribute for
devlink rate object.


>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 new parameter in devlink-rate that will allow for
>configuration of strict priority.
>
>Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com>
>---
> include/net/devlink.h        |  6 ++++++
> include/uapi/linux/devlink.h |  1 +
> net/core/devlink.c           | 29 +++++++++++++++++++++++++++++
> 3 files changed, 36 insertions(+)
>
>diff --git a/include/net/devlink.h b/include/net/devlink.h
>index ba6b8b094943..9d2b0c3c4ad3 100644
>--- a/include/net/devlink.h
>+++ b/include/net/devlink.h
>@@ -114,6 +114,8 @@ struct devlink_rate {
> 			refcount_t refcnt;
> 		};
> 	};
>+
>+	u16 tx_priority;
> };
> 
> struct devlink_port {
>@@ -1493,10 +1495,14 @@ struct devlink_ops {
> 				      u64 tx_share, struct netlink_ext_ack *extack);
> 	int (*rate_leaf_tx_max_set)(struct devlink_rate *devlink_rate, void *priv,
> 				    u64 tx_max, struct netlink_ext_ack *extack);
>+	int (*rate_leaf_tx_priority_set)(struct devlink_rate *devlink_rate, void *priv,
>+					 u64 tx_priority, struct netlink_ext_ack *extack);
> 	int (*rate_node_tx_share_set)(struct devlink_rate *devlink_rate, void *priv,
> 				      u64 tx_share, struct netlink_ext_ack *extack);
> 	int (*rate_node_tx_max_set)(struct devlink_rate *devlink_rate, void *priv,
> 				    u64 tx_max, struct netlink_ext_ack *extack);
>+	int (*rate_node_tx_priority_set)(struct devlink_rate *devlink_rate, void *priv,
>+					 u64 tx_priority, struct netlink_ext_ack *extack);
> 	int (*rate_node_new)(struct devlink_rate *rate_node, void **priv,
> 			     struct netlink_ext_ack *extack);
> 	int (*rate_node_del)(struct devlink_rate *rate_node, void *priv,
>diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
>index 2f24b53a87a5..b3df5bc45ba5 100644
>--- a/include/uapi/linux/devlink.h
>+++ b/include/uapi/linux/devlink.h
>@@ -607,6 +607,7 @@ enum devlink_attr {
> 
> 	DEVLINK_ATTR_SELFTESTS,			/* nested */
> 
>+	DEVLINK_ATTR_RATE_TX_PRIORITY,		/* u16 */
> 	/* add new attributes above here, update the policy in devlink.c */
> 
> 	__DEVLINK_ATTR_MAX,
>diff --git a/net/core/devlink.c b/net/core/devlink.c
>index 89baa7c0938b..2586b1307cb4 100644
>--- a/net/core/devlink.c
>+++ b/net/core/devlink.c
>@@ -1184,6 +1184,9 @@ static int devlink_nl_rate_fill(struct sk_buff *msg,
> 			      devlink_rate->tx_max, DEVLINK_ATTR_PAD))
> 		goto nla_put_failure;
> 
>+	if (nla_put_u16(msg, DEVLINK_ATTR_RATE_TX_PRIORITY,
>+			devlink_rate->tx_priority))
>+		goto nla_put_failure;
> 	if (devlink_rate->parent)
> 		if (nla_put_string(msg, DEVLINK_ATTR_RATE_PARENT_NODE_NAME,
> 				   devlink_rate->parent->name))
>@@ -1924,6 +1927,7 @@ static int devlink_nl_rate_set(struct devlink_rate *devlink_rate,
> {
> 	struct nlattr *nla_parent, **attrs = info->attrs;
> 	int err = -EOPNOTSUPP;
>+	u16 priority;
> 	u64 rate;
> 
> 	if (attrs[DEVLINK_ATTR_RATE_TX_SHARE]) {
>@@ -1952,6 +1956,20 @@ static int devlink_nl_rate_set(struct devlink_rate *devlink_rate,
> 		devlink_rate->tx_max = rate;
> 	}
> 
>+	if (attrs[DEVLINK_ATTR_RATE_TX_PRIORITY]) {
>+		priority = nla_get_u16(attrs[DEVLINK_ATTR_RATE_TX_PRIORITY]);
>+		if (devlink_rate_is_leaf(devlink_rate))
>+			err = ops->rate_leaf_tx_priority_set(devlink_rate, devlink_rate->priv,
>+							priority, info->extack);
>+		else if (devlink_rate_is_node(devlink_rate))
>+			err = ops->rate_node_tx_priority_set(devlink_rate, devlink_rate->priv,
>+							priority, info->extack);
>+
>+		if (err)
>+			return err;
>+		devlink_rate->tx_priority = priority;
>+	}
>+
> 	nla_parent = attrs[DEVLINK_ATTR_RATE_PARENT_NODE_NAME];
> 	if (nla_parent) {
> 		err = devlink_nl_rate_parent_node_set(devlink_rate, info,
>@@ -1983,6 +2001,11 @@ static bool devlink_rate_set_ops_supported(const struct devlink_ops *ops,
> 			NL_SET_ERR_MSG_MOD(info->extack, "Parent set isn't supported for the leafs");
> 			return false;
> 		}
>+		if (attrs[DEVLINK_ATTR_RATE_TX_PRIORITY] && !ops->rate_leaf_tx_priority_set) {
>+			NL_SET_ERR_MSG_MOD(info->extack,
>+					   "TX priority set isn't supported for the leafs");
>+			return false;
>+		}
> 	} else if (type == DEVLINK_RATE_TYPE_NODE) {
> 		if (attrs[DEVLINK_ATTR_RATE_TX_SHARE] && !ops->rate_node_tx_share_set) {
> 			NL_SET_ERR_MSG_MOD(info->extack, "TX share set isn't supported for the nodes");
>@@ -1997,6 +2020,11 @@ static bool devlink_rate_set_ops_supported(const struct devlink_ops *ops,
> 			NL_SET_ERR_MSG_MOD(info->extack, "Parent set isn't supported for the nodes");
> 			return false;
> 		}
>+		if (attrs[DEVLINK_ATTR_RATE_TX_PRIORITY] && !ops->rate_node_tx_priority_set) {
>+			NL_SET_ERR_MSG_MOD(info->extack,
>+					   "TX priority set isn't supported for the nodes");
>+			return false;
>+		}
> 	} else {
> 		WARN(1, "Unknown type of rate object");
> 		return false;
>@@ -9172,6 +9200,7 @@ static const struct nla_policy devlink_nl_policy[DEVLINK_ATTR_MAX + 1] = {
> 	[DEVLINK_ATTR_LINECARD_INDEX] = { .type = NLA_U32 },
> 	[DEVLINK_ATTR_LINECARD_TYPE] = { .type = NLA_NUL_STRING },
> 	[DEVLINK_ATTR_SELFTESTS] = { .type = NLA_NESTED },
>+	[DEVLINK_ATTR_RATE_TX_PRIORITY] = { .type = NLA_U16 },

Why not u32?


> };
> 
> static const struct genl_small_ops devlink_nl_ops[] = {
>-- 
>2.37.2
>

  reply	other threads:[~2022-10-31 10:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28 10:51 [PATCH net-next v8 0/9] Implement devlink-rate API and extend it Michal Wilczynski
2022-10-28 10:51 ` [PATCH net-next v8 1/9] devlink: Introduce new parameter 'tx_priority' to devlink-rate Michal Wilczynski
2022-10-31 10:13   ` Jiri Pirko [this message]
2022-11-02 10:38     ` Wilczynski, Michal
2022-10-28 10:51 ` [PATCH net-next v8 2/9] devlink: Introduce new parameter 'tx_weight' " Michal Wilczynski
2022-10-28 10:51 ` [PATCH net-next v8 3/9] devlink: Enable creation of the devlink-rate nodes from the driver Michal Wilczynski
2022-10-31 10:19   ` Jiri Pirko
2022-11-04 14:34     ` Wilczynski, Michal
2022-10-28 10:51 ` [PATCH net-next v8 4/9] devlink: Allow for devlink-rate nodes parent reassignment Michal Wilczynski
2022-10-31 10:25   ` Jiri Pirko
2022-10-28 10:51 ` [PATCH net-next v8 5/9] devlink: Allow to set up parent in devl_rate_leaf_create() Michal Wilczynski
2022-10-31 10:26   ` Jiri Pirko
2022-10-28 10:51 ` [PATCH net-next v8 6/9] devlink: Allow to change priv in devlink-rate from parent_set callbacks Michal Wilczynski
2022-10-31 12:22   ` Jiri Pirko
2022-11-04 14:38     ` Wilczynski, Michal
2022-10-28 10:51 ` [PATCH net-next v8 7/9] ice: Introduce new parameters in ice_sched_node Michal Wilczynski
2022-10-28 10:51 ` [PATCH net-next v8 8/9] ice: Implement devlink-rate API Michal Wilczynski
2022-10-28 10:51 ` [PATCH net-next v8 9/9] ice: Prevent ADQ, DCB, RDMA coexistence with Custom Tx scheduler Michal Wilczynski

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=Y1+ftW7vmzJlg48+@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=alexandr.lobakin@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=ecree.xilinx@gmail.com \
    --cc=jacob.e.keller@intel.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=kuba@kernel.org \
    --cc=michal.wilczynski@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=przemyslaw.kitszel@intel.com \
    /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