History

devlink: Introduce rate nodes

Implement support for DEVLINK_CMD_RATE_{NEW|DEL} commands that are used to create and delete devlink rate nodes. Add new attribute DEVLINK_ATTR_RATE_NODE_NAME that specify node name string. The node name is an alphanumeric identifier. No valid node name can be a devlink port index, eg. decimal number. Extend devlink ops with new callbacks rate_node_{new|del}() and rate_node_tx_{share|max}_set() to allow supporting drivers to implement ports rate grouping and setting tx rate of rate nodes through devlink. Expose devlink_rate_nodes_destroy() function to allow vendor driver do proper cleanup of internally allocated resources for the nodes if the driver goes down or due to any other reasons which requires nodes to be destroyed. Disallow moving device from switchdev to legacy mode if any node exists on that device. User must explicitly delete nodes before switching mode. Example: $ devlink port function rate add netdevsim/netdevsim10/group1 $ devlink port function rate set netdevsim/netdevsim10/group1 \ tx_share 10mbit tx_max 100mbit Add + set command can be combined: $ devlink port function rate add netdevsim/netdevsim10/group1 \ tx_share 10mbit tx_max 100mbit $ devlink port function rate show netdevsim/netdevsim10/group1 netdevsim/netdevsim10/group1: type node tx_share 10mbit tx_max 100mbit $ devlink port function rate del netdevsim/netdevsim10/group1

Dmytro Linkin committed 5 years ago

Commit a8ecb931 parent 31f07233 files · +247 −8Browse files

Showing the changes to include/uapi (1 of 3 files). Show all

Unified · Split

include/uapi/linux/devlink.h+3−0
@@ -213,6 +213,7 @@ enum devlink_port_flavour { · 212 unmodified lines
213213
214214 enum devlink_rate_type {
215215 DEVLINK_RATE_TYPE_LEAF,
216+ DEVLINK_RATE_TYPE_NODE,
216217 };
217218
218219 enum devlink_param_cmode {
@@ -547,6 +548,8 @@ enum devlink_attr { · 328 unmodified lines
547548 DEVLINK_ATTR_RATE_TYPE, /* u16 */
548549 DEVLINK_ATTR_RATE_TX_SHARE, /* u64 */
549550 DEVLINK_ATTR_RATE_TX_MAX, /* u64 */
551+ DEVLINK_ATTR_RATE_NODE_NAME, /* string */
552+
550553 /* add new attributes above here, update the policy in devlink.c */
551554
552555 __DEVLINK_ATTR_MAX,