Add support for resource abstraction
Subsystems (4)
Jiri Pirko
maintainerv2 cover Add support for resource abstraction
From: Jiri Pirko <[email protected]>
Many of the ASIC's internal resources are limited and are shared between several hardware procedures. For example, unified hash-based memory can be used for many lookup purposes, like FDB and LPM. In many cases the user can provide a partitioning scheme for such a resource in order to perform fine tuning for his application. In such cases performing driver reload is needed for the changes to take place, thus this patchset also adds support for hot reload.
Such an abstraction can be coupled with devlink's dpipe interface, which models the ASIC's pipeline as a graph of match/action tables. By modeling the hardware resource object, and by coupling it to several dpipe tables, further visibility can be achieved in order to debug ASIC-wide issues.
The proposed interface will provide the user the ability to understand the limitations of the hardware, and receive notification regarding its occupancy. Furthermore, monitoring the resource occupancy can be done in real-time and can be useful in many cases.
---
Userspace part prototype can be found at https://github.com/arkadis/iproute2/
at resource_dev branch.
v1->v2
- Add resource size attribute.
- Fix split bug.
Arkadi Sharshevsky (10):
devlink: Add per devlink instance lock
devlink: Add support for resource abstraction
devlink: Add support for reload
devlink: Add relation between dpipe and resource
mlxsw: pci: Add support for performing bus reset
mlxsw: spectrum: Register KVD resources with devlink
mlxsw: spectrum_dpipe: Connect dpipe tables to resources
mlxsw: spectrum: Add support for getting kvdl occupancy
mlxsw: pci: Add support for getting resource through devlink
mlxsw: core: Add support for reload
drivers/net/ethernet/mellanox/mlxsw/core.c | 85 ++- drivers/net/ethernet/mellanox/mlxsw/core.h | 16 +- drivers/net/ethernet/mellanox/mlxsw/i2c.c | 5 +- drivers/net/ethernet/mellanox/mlxsw/pci.c | 98 ++-- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 205 ++++++++ drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 13 + .../net/ethernet/mellanox/mlxsw/spectrum_dpipe.c | 72 ++- .../net/ethernet/mellanox/mlxsw/spectrum_kvdl.c | 26 + include/net/devlink.h | 97 ++++ include/uapi/linux/devlink.h | 21 + net/core/devlink.c | 573 ++++++++++++++++++--- 11 files changed, 1079 insertions(+), 132 deletions(-)
Signature · 1 line
2.9.5
Jiri Pirko
maintainerPATCH v2 1/10 devlink: Add per devlink instance lock
From: Arkadi Sharshevsky <[email protected]>
This is a preparation before introducing resources and hot reload support. Currently there are two global lock where one protects all devlink access, and the second one protects devlink port access. This patch adds per devlink instance lock which protects the internal members which are the sb/dpipe/ resource/ports. By introducing this lock the global devlink port lock can be discarded.
---v1->v2
- Add flag for indication about not locking the devlink per-instance lock. It is currently used for port split commands, and will be used for reload as well.
--- include/net/devlink.h | 1 + net/core/devlink.c | 136 ++++++++++++++++++++++++++++---------------------- 2 files changed, 78 insertions(+), 59 deletions(-)
include/net/devlink.h +1 -0
@@ -30,6 +30,7 @@ struct devlink {const struct devlink_ops *ops;struct device *dev;possible_net_t _net; +struct mutex lock;char priv[0 ]__aligned(NETDEV_ALIGN) ; };
net/core/devlink.c +77 -59
377 lines not on this page · raw message
Signature · 1 line
2.9.5
Jiri Pirko
maintainerPATCH v2 2/10 devlink: Add support for resource abstraction
In reply to Jiri PirkoFrom: Arkadi Sharshevsky <[email protected]>
Add support for hardware resource abstraction over devlink. Each resource is identified via id, furthermore it contains information regarding its size and its related sub resources. Each resource can also provide its current occupancy.
In some cases the sizes of some resources can be changed, yet for those changes to take place a hot driver reload may be needed. The reload capability will be introduced in the next patch.
---v1->v2
- Add resource unit.
--- include/net/devlink.h | 82 ++++++++++ include/uapi/linux/devlink.h | 15 ++ net/core/devlink.c | 358 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 455 insertions(+)
include/net/devlink.h +82 -0
@@ -26,6 +26,7 @@ struct devlink {struct list_head port_list;struct list_head sb_list;struct list_head dpipe_table_list; +struct list_head resource_list;struct devlink_dpipe_headers *dpipe_headers;const struct devlink_ops *ops;struct device *dev;
@@ -224,6 +225,47 @@ struct devlink_dpipe_headers {unsigned int headers_count; }; +/** +* struct devlink_resource_ops - resource ops +* @occ_get: get the occupied size +* @size_validate: validate the size of the resource before update, reload +* is needed for changes to take place +*/ +struct devlink_resource_ops { +u64 (*occ_get)(struct devlink *devlink); +int (*size_validate)(struct devlink *devlink,u64 size, +struct netlink_ext_ack *extack); +}; + +/** +* struct devlink_resource - devlink resource +* @name: name of the resource +* @size: size of the resource +* @size_new: updated size of the resource, reload is needed +* @size_valid: valid in case the total size of the resource is valid +* including its children +* @id: id, per devlink instance +* @unit: resource's unit +* @parent: parent resource +* @list: parent list +* @resource_list: list of child resources +* @resource_ops: resource ops +*/ +struct devlink_resource { +const char *name; +u64 size; +u64 size_new; +bool size_valid; +u64 id; +enum devlink_resource_unit unit; +struct devlink_resource *parent; +struct list_head list; +struct list_head resource_list; +const struct devlink_resource_ops *resource_ops; +}; + +#define DEVLINK_RESOURCE_ID_PARENT_TOP 0 +struct devlink_ops {int (*port_type_set)(struct devlink_port *devlink_port,enum devlink_port_type port_type);
@@ -333,6 +375,20 @@ extern struct devlink_dpipe_header devlink_dpipe_header_ethernet;extern struct devlink_dpipe_header devlink_dpipe_header_ipv4;extern struct devlink_dpipe_header devlink_dpipe_header_ipv6; +int devlink_resource_register (struct devlink *devlink, +const char *resource_name, +bool top_hierarchy, +u64 resource_size, +u64 resource_id, +u64 parent_resource_id, +enum devlink_resource_unit unit, +const struct devlink_resource_ops *resource_ops); +void devlink_resources_unregister (struct devlink *devlink, +struct devlink_resource *resource); +int devlink_resource_size_get (struct devlink *devlink, +u64 resource_id, +u64 *p_resource_size); +#else static inline struct devlink *devlink_alloc(const struct devlink_ops *ops,
@@ -469,6 +525,32 @@ devlink_dpipe_match_put(struct sk_buff *skb,return 0 ; } +static inline int +devlink_resource_register (struct devlink *devlink, +const char *resource_name, +bool top_hierarchy, +u64 resource_size, +u64 resource_id, +u64 parent_resource_id, +enum devlink_resource_unit unit, +const struct devlink_resource_ops *resource_ops) +{ +return 0 ; +} + +static inline void +devlink_resources_unregister (struct devlink *devlink, +struct devlink_resource *resource) +{ +} + +static inline int +devlink_resource_size_get (struct devlink *devlink,u64 resource_id, +u64 *p_resource_size) +{ +return -EOPNOTSUPP ; +} +#endif #endif /* _NET_DEVLINK_H_ */
include/uapi/linux/devlink.h +15 -0
@@ -70,6 +70,8 @@ enum devlink_command {DEVLINK_CMD_DPIPE_ENTRIES_GET ,DEVLINK_CMD_DPIPE_HEADERS_GET ,DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET , +DEVLINK_CMD_RESOURCE_SET , +DEVLINK_CMD_RESOURCE_DUMP ,/* add new commands above here */ __DEVLINK_CMD_MAX,
@@ -202,6 +204,15 @@ enum devlink_attr {DEVLINK_ATTR_PAD ,DEVLINK_ATTR_ESWITCH_ENCAP_MODE ,/* u8 */ +DEVLINK_ATTR_RESOURCE_LIST ,/* nested */ +DEVLINK_ATTR_RESOURCE ,/* nested */ +DEVLINK_ATTR_RESOURCE_NAME ,/* string */ +DEVLINK_ATTR_RESOURCE_SIZE ,/* u64 */ +DEVLINK_ATTR_RESOURCE_SIZE_NEW ,/* u64 */ +DEVLINK_ATTR_RESOURCE_SIZE_VALID ,/* u8 */ +DEVLINK_ATTR_RESOURCE_UNIT ,/* u8 */ +DEVLINK_ATTR_RESOURCE_OCC ,/* u64 */ +DEVLINK_ATTR_RESOURCE_ID ,/* u64 */ /* add new attributes above here, update the policy in devlink.c */
@@ -245,4 +256,8 @@ enum devlink_dpipe_header_id { DEVLINK_DPIPE_HEADER_IPV6, }; +enum devlink_resource_unit { +DEVLINK_RESOURCE_UNIT_DOUBLE_WORD , +}; +#endif /* _UAPI_LINUX_DEVLINK_H_ */
net/core/devlink.c +358 -0
388 lines not on this page · raw message
Signature · 1 line
2.9.5
Jiri Pirko
maintainerPATCH v2 3/10 devlink: Add support for reload
In reply to Jiri PirkoFrom: Arkadi Sharshevsky <[email protected]>
Add support for performing driver hot reload.
---v1->v2
- Use the NO_LOCK flag instead of releasing the lock manually.
--- include/net/devlink.h | 1 + include/uapi/linux/devlink.h | 5 +++++ net/core/devlink.c | 48 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+)
include/net/devlink.h +1 -0
@@ -267,6 +267,7 @@ struct devlink_resource {#define DEVLINK_RESOURCE_ID_PARENT_TOP 0struct devlink_ops { +int (*reload)(struct devlink *devlink);int (*port_type_set)(struct devlink_port *devlink_port,enum devlink_port_type port_type); int (*port_split)(struct devlink *devlink, unsigned int port_index,
include/uapi/linux/devlink.h +5 -0
@@ -73,6 +73,11 @@ enum devlink_command {DEVLINK_CMD_RESOURCE_SET ,DEVLINK_CMD_RESOURCE_DUMP , +/* Hot driver reload, makes configuration changes take place. The +* devlink instance is not released during the process. +*/ +DEVLINK_CMD_RELOAD , +/* add new commands above here */ __DEVLINK_CMD_MAX,DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX -1
net/core/devlink.c +48 -0
60 lines not on this page · raw message
Signature · 1 line
2.9.5
Jiri Pirko
maintainerPATCH v2 4/10 devlink: Add relation between dpipe and resource
In reply to Jiri PirkoFrom: Arkadi Sharshevsky <[email protected]>
The hardware processes which are modeled via dpipe commonly use some internal hardware resources. Such relation can improve the understanding of hardware limitations.
--- include/net/devlink.h | 13 +++++++++++++ include/uapi/linux/devlink.h | 1 + net/core/devlink.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+)
include/net/devlink.h +13 -0
@@ -183,6 +183,8 @@ struct devlink_dpipe_table_ops;* @counters_enabled: indicates if counters are active * @counter_control_extern: indicates if counter control is in dpipe or * external tool +* @resource_valid: Indicate that the resource id is valid +* @resource_id: relative resource this table is related to * @table_ops: table operations * @rcu: rcu */
@@ -192,6 +194,8 @@ struct devlink_dpipe_table {const char *name;bool counters_enabled;bool counter_control_extern; +bool resource_valid; +u64 resource_id;struct devlink_dpipe_table_ops *table_ops;struct rcu_head rcu; };
@@ -389,6 +393,8 @@ void devlink_resources_unregister(struct devlink *devlink,int devlink_resource_size_get (struct devlink *devlink,u64 resource_id,u64 *p_resource_size); +int devlink_dpipe_table_resource_set (struct devlink *devlink, +const char *table_name,u64 resource_id);#else
@@ -552,6 +558,13 @@ devlink_resource_size_get(struct devlink *devlink, u64 resource_id,return -EOPNOTSUPP ; } +static inline int +devlink_dpipe_table_resource_set (struct devlink *devlink, +const char *table_name,u64 resource_id) +{ +return -EOPNOTSUPP ; +} +#endif #endif /* _NET_DEVLINK_H_ */
include/uapi/linux/devlink.h +1 -0
@@ -218,6 +218,7 @@ enum devlink_attr {DEVLINK_ATTR_RESOURCE_UNIT ,/* u8 */ DEVLINK_ATTR_RESOURCE_OCC ,/* u64 */ DEVLINK_ATTR_RESOURCE_ID ,/* u64 */ + DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID, /* u64 *//* add new attributes above here, update the policy in devlink.c */
net/core/devlink.c +31 -0
@@ -1694,6 +1694,9 @@ static int devlink_dpipe_table_put(struct sk_buff *skb, table->counters_enabled)) goto nla_put_failure; +if (table->resource_valid) +nla_put_u64_64bit (skb,DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID , + table->resource_id,DEVLINK_ATTR_PAD );if (devlink_dpipe_matches_put (table, skb)) goto nla_put_failure;
@@ -3239,6 +3242,34 @@ int devlink_resource_size_get(struct devlink *devlink, }EXPORT_SYMBOL_GPL (devlink_resource_size_get); +/** +* devlink_dpipe_table_resource_set - set the resource id +* +* @devlink: devlink +* @table_name: table name +* @resource_id: resource id +*/ +int devlink_dpipe_table_resource_set (struct devlink *devlink, +const char *table_name,u64 resource_id) +{ +struct devlink_dpipe_table *table; +int err =0 ; + +mutex_lock (&devlink->lock); + table =devlink_dpipe_table_find (&devlink->dpipe_table_list, + table_name); +if (!table) { + err = -EINVAL ; + goto out; + } + table->resource_id = resource_id; + table->resource_valid = true; +out: +mutex_unlock (&devlink->lock); +return err; +} +EXPORT_SYMBOL_GPL (devlink_dpipe_table_resource_set); +static int __init devlink_module_init (void ) {return genl_register_family (&devlink_nl_family);
Signature · 1 line
2.9.5
Jiri Pirko
maintainerPATCH v2 5/10 mlxsw: pci: Add support for performing bus reset
In reply to Jiri PirkoFrom: Arkadi Sharshevsky <[email protected]>
This is a preparation stage before introducing hot reload. During the reload process the ASIC should be resetted by accessing the PCI BAR due to unavailability of the mailbox/emad interfaces.
--- drivers/net/ethernet/mellanox/mlxsw/core.h | 1 + drivers/net/ethernet/mellanox/mlxsw/pci.c | 53 ++++++++++++++++++++++-------- 2 files changed, 41 insertions(+), 13 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core.h +1 -0
@@ -332,6 +332,7 @@ struct mlxsw_bus {const struct mlxsw_config_profile *profile, struct mlxsw_res *res);void (*fini)(void *bus_priv); +void (*reset)(void *bus_priv);bool (*skb_transmit_busy)(void *bus_priv,const struct mlxsw_tx_info *tx_info); int (*skb_transmit)(void *bus_priv, struct sk_buff *skb,
drivers/net/ethernet/mellanox/mlxsw/pci.c +40 -13
95 lines not on this page · raw message
Signature · 1 line
2.9.5
Jiri Pirko
maintainerPATCH v2 6/10 mlxsw: spectrum: Register KVD resources with devlink
In reply to Jiri PirkoFrom: Arkadi Sharshevsky <[email protected]>
Register the KVD resources with devlink. The KVD is a memory resource which is subdivided into three partitions which are the linear, hash single and hash double.
---v1->v2
- Add resource unit of double word for all the resources.
--- drivers/net/ethernet/mellanox/mlxsw/core.c | 9 ++ drivers/net/ethernet/mellanox/mlxsw/core.h | 1 + drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 139 +++++++++++++++++++++++++ drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 12 +++ 4 files changed, 161 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/core.c +9 -0
@@ -1012,6 +1012,12 @@ int mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info,if (err) goto err_bus_init; +if (mlxsw_driver->resources_register) { + err = mlxsw_driver->resources_register (mlxsw_core); +if (err) + goto err_register_resources; + } + err =mlxsw_ports_init (mlxsw_core);if (err) goto err_ports_init;
@@ -1067,6 +1073,8 @@ int mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info, err_ports_init: mlxsw_bus->fini (bus_priv); err_bus_init: +devlink_resources_unregister (devlink,NULL ); +err_register_resources:devlink_free (devlink); err_devlink_alloc:mlxsw_core_driver_put (device_kind);
@@ -1086,6 +1094,7 @@ void mlxsw_core_bus_device_unregister(struct mlxsw_core *mlxsw_core)mlxsw_emad_fini (mlxsw_core);kfree (mlxsw_core->lag.mapping);mlxsw_ports_fini (mlxsw_core); +devlink_resources_unregister (devlink,NULL ); mlxsw_core->bus->fini (mlxsw_core->bus_priv);devlink_free (devlink);mlxsw_core_driver_put (device_kind);
drivers/net/ethernet/mellanox/mlxsw/core.h +1 -0
@@ -308,6 +308,7 @@ struct mlxsw_driver { u32 *p_cur, u32 *p_max);void (*txhdr_construct)(struct sk_buff *skb,const struct mlxsw_tx_info *tx_info); +int (*resources_register)(struct mlxsw_core *mlxsw_core);u8 txhdr_len;const struct mlxsw_config_profile *profile; };
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +139 -0
151 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlxsw/spectrum.h +12 -0
@@ -66,6 +66,18 @@#define MLXSW_SP_KVD_LINEAR_SIZE 98304/* entries */ #define MLXSW_SP_KVD_GRANULARITY 128 +#define MLXSW_SP_RESOURCE_NAME_KVD "kvd" +#define MLXSW_SP_RESOURCE_NAME_KVD_LINEAR "linear" +#define MLXSW_SP_RESOURCE_NAME_KVD_HASH_SINGLE "hash_single" +#define MLXSW_SP_RESOURCE_NAME_KVD_HASH_DOUBLE "hash_double" + +enum mlxsw_sp_resource_id { +MLXSW_SP_RESOURCE_KVD , +MLXSW_SP_RESOURCE_KVD_LINEAR , +MLXSW_SP_RESOURCE_KVD_HASH_SINGLE , +MLXSW_SP_RESOURCE_KVD_HASH_DOUBLE , +}; +struct mlxsw_sp_port ;struct mlxsw_sp_rif ;
Signature · 1 line
2.9.5
Jiri Pirko
maintainerPATCH v2 7/10 mlxsw: spectrum_dpipe: Connect dpipe tables to resources
In reply to Jiri PirkoFrom: Arkadi Sharshevsky <[email protected]>
Connect current dpipe tables to resources. The tables are connected in the following fashion:
1. IPv4 host - KVD hash single
2. IPv6 host - KVD hash double
3. Adjacency - KVD linear
--- .../net/ethernet/mellanox/mlxsw/spectrum_dpipe.c | 72 ++++++++++++++++++---- 1 file changed, 60 insertions(+), 12 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c +60 -12
@@ -774,11 +774,27 @@ static struct devlink_dpipe_table_ops mlxsw_sp_host4_ops = {static int mlxsw_sp_dpipe_host4_table_init (struct mlxsw_sp *mlxsw_sp) {struct devlink *devlink =priv_to_devlink (mlxsw_sp->core); +int err; -return devlink_dpipe_table_register (devlink, -MLXSW_SP_DPIPE_TABLE_NAME_HOST4 , - &mlxsw_sp_host4_ops, - mlxsw_sp, false); + err =devlink_dpipe_table_register (devlink, +MLXSW_SP_DPIPE_TABLE_NAME_HOST4 , + &mlxsw_sp_host4_ops, + mlxsw_sp, false); +if (err) +return err; + + err =devlink_dpipe_table_resource_set (devlink, +MLXSW_SP_DPIPE_TABLE_NAME_HOST4 , +MLXSW_SP_RESOURCE_KVD_HASH_SINGLE ); +if (err) + goto err_resource_set; + +return 0 ; + +err_resource_set: +devlink_dpipe_table_unregister (devlink, +MLXSW_SP_DPIPE_TABLE_NAME_HOST4 ); +return err; }static void mlxsw_sp_dpipe_host4_table_fini (struct mlxsw_sp *mlxsw_sp)
@@ -832,11 +848,27 @@ static struct devlink_dpipe_table_ops mlxsw_sp_host6_ops = {static int mlxsw_sp_dpipe_host6_table_init (struct mlxsw_sp *mlxsw_sp) {struct devlink *devlink =priv_to_devlink (mlxsw_sp->core); +int err; -return devlink_dpipe_table_register (devlink, -MLXSW_SP_DPIPE_TABLE_NAME_HOST6 , - &mlxsw_sp_host6_ops, - mlxsw_sp, false); + err =devlink_dpipe_table_register (devlink, +MLXSW_SP_DPIPE_TABLE_NAME_HOST6 , + &mlxsw_sp_host6_ops, + mlxsw_sp, false); +if (err) +return err; + + err =devlink_dpipe_table_resource_set (devlink, +MLXSW_SP_DPIPE_TABLE_NAME_HOST6 , +MLXSW_SP_RESOURCE_KVD_HASH_DOUBLE ); +if (err) + goto err_resource_set; + +return 0 ; + +err_resource_set: +devlink_dpipe_table_unregister (devlink, +MLXSW_SP_DPIPE_TABLE_NAME_HOST6 ); +return err; }static void mlxsw_sp_dpipe_host6_table_fini (struct mlxsw_sp *mlxsw_sp)
@@ -1216,11 +1248,27 @@ static struct devlink_dpipe_table_ops mlxsw_sp_dpipe_table_adj_ops = {static int mlxsw_sp_dpipe_adj_table_init (struct mlxsw_sp *mlxsw_sp) {struct devlink *devlink =priv_to_devlink (mlxsw_sp->core); +int err; -return devlink_dpipe_table_register (devlink, -MLXSW_SP_DPIPE_TABLE_NAME_ADJ , - &mlxsw_sp_dpipe_table_adj_ops, - mlxsw_sp, false); + err =devlink_dpipe_table_register (devlink, +MLXSW_SP_DPIPE_TABLE_NAME_ADJ , + &mlxsw_sp_dpipe_table_adj_ops, + mlxsw_sp, false); +if (err) +return err; + + err =devlink_dpipe_table_resource_set (devlink, +MLXSW_SP_DPIPE_TABLE_NAME_ADJ , +MLXSW_SP_RESOURCE_KVD_LINEAR ); +if (err) + goto err_resource_set; + +return 0 ; + +err_resource_set: +devlink_dpipe_table_unregister (devlink, +MLXSW_SP_DPIPE_TABLE_NAME_ADJ ); +return err; }static void mlxsw_sp_dpipe_adj_table_fini (struct mlxsw_sp *mlxsw_sp)
Signature · 1 line
2.9.5
Jiri Pirko
maintainerPATCH v2 8/10 mlxsw: spectrum: Add support for getting kvdl occupancy
In reply to Jiri PirkoFrom: Arkadi Sharshevsky <[email protected]>
Add support for getting the kvdl occupancy through the resource interface.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 9 ++++++++ drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 1 + .../net/ethernet/mellanox/mlxsw/spectrum_kvdl.c | 26 ++++++++++++++++++++++ 3 files changed, 36 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +9 -0
@@ -4043,12 +4043,21 @@ mlxsw_sp_resource_kvd_hash_double_size_validate(struct devlink *devlink, u64 sizreturn 0 ; } +static u64 mlxsw_sp_resource_kvd_linear_occ_get (struct devlink *devlink) +{ +struct mlxsw_core *mlxsw_core =devlink_priv (devlink); +struct mlxsw_sp *mlxsw_sp =mlxsw_core_driver_priv (mlxsw_core); + +return mlxsw_sp_kvdl_occ_get (mlxsw_sp); +} +static struct devlink_resource_ops mlxsw_sp_resource_kvd_ops = { .size_validate = mlxsw_sp_resource_kvd_size_validate, };static struct devlink_resource_ops mlxsw_sp_resource_kvd_linear_ops = { .size_validate = mlxsw_sp_resource_kvd_linear_size_validate, + .occ_get = mlxsw_sp_resource_kvd_linear_occ_get, };static struct devlink_resource_ops mlxsw_sp_resource_kvd_hash_single_ops = {
drivers/net/ethernet/mellanox/mlxsw/spectrum.h +1 -0
@@ -469,6 +469,7 @@ void mlxsw_sp_kvdl_free(struct mlxsw_sp *mlxsw_sp, int entry_index);int mlxsw_sp_kvdl_alloc_size_query (struct mlxsw_sp *mlxsw_sp,unsigned int entry_count,unsigned int *p_alloc_size); +u64 mlxsw_sp_kvdl_occ_get (const struct mlxsw_sp *mlxsw_sp);struct mlxsw_sp_acl_rule_info {unsigned int priority;
drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c +26 -0
@@ -286,6 +286,32 @@ static void mlxsw_sp_kvdl_parts_fini(struct mlxsw_sp *mlxsw_sp)mlxsw_sp_kvdl_part_fini (mlxsw_sp, i); } +u64 mlxsw_sp_kvdl_part_occ (struct mlxsw_sp_kvdl_part *part) +{ +unsigned int nr_entries; +int bit =-1 ; +u64 occ =0 ; + + nr_entries = (part->info->end_index - + part->info->start_index +1 ) / + part->info->alloc_size; +while ((bit =find_next_bit (part->usage, nr_entries, bit +1 )) + < nr_entries) + occ += part->info->alloc_size; +return occ; +} + +u64 mlxsw_sp_kvdl_occ_get (const struct mlxsw_sp *mlxsw_sp) +{ +struct mlxsw_sp_kvdl_part *part; +u64 occ =0 ; + +list_for_each_entry (part, &mlxsw_sp->kvdl->parts_list, list) + occ +=mlxsw_sp_kvdl_part_occ (part); + +return occ; +} +int mlxsw_sp_kvdl_init (struct mlxsw_sp *mlxsw_sp) {struct mlxsw_sp_kvdl *kvdl;
Signature · 1 line
2.9.5
Jiri Pirko
maintainerPATCH v2 9/10 mlxsw: pci: Add support for getting resource through devlink
In reply to Jiri PirkoFrom: Arkadi Sharshevsky <[email protected]>
Up until now the KVD partition was static. This patch introduces the ability to get the resource sizes via devlink. In case the resource is not available the default configuration is used.
--- drivers/net/ethernet/mellanox/mlxsw/core.c | 16 ++++++++ drivers/net/ethernet/mellanox/mlxsw/core.h | 9 ++++ drivers/net/ethernet/mellanox/mlxsw/pci.c | 40 +++++------------- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 57 ++++++++++++++++++++++++++ 4 files changed, 92 insertions(+), 30 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core.c +16 -0
@@ -1800,6 +1800,22 @@ void mlxsw_core_flush_owq(void) }EXPORT_SYMBOL (mlxsw_core_flush_owq); +int mlxsw_core_kvd_sizes_get (struct mlxsw_core *mlxsw_core, +const struct mlxsw_config_profile *profile, +u64 *p_single_size,u64 *p_double_size, +u64 *p_linear_size) +{ +struct mlxsw_driver *driver = mlxsw_core->driver; + +if (!driver->kvd_sizes_get) +return -EINVAL ; + +return driver->kvd_sizes_get (mlxsw_core, profile, + p_single_size, p_double_size, + p_linear_size); +} +EXPORT_SYMBOL (mlxsw_core_kvd_sizes_get); +static int __init mlxsw_core_module_init (void ) {int err;
drivers/net/ethernet/mellanox/mlxsw/core.h +9 -0
@@ -309,10 +309,19 @@ struct mlxsw_driver {void (*txhdr_construct)(struct sk_buff *skb,const struct mlxsw_tx_info *tx_info);int (*resources_register)(struct mlxsw_core *mlxsw_core); +int (*kvd_sizes_get)(struct mlxsw_core *mlxsw_core, +const struct mlxsw_config_profile *profile, +u64 *p_single_size,u64 *p_double_size, +u64 *p_linear_size);u8 txhdr_len;const struct mlxsw_config_profile *profile; }; +int mlxsw_core_kvd_sizes_get (struct mlxsw_core *mlxsw_core, +const struct mlxsw_config_profile *profile, +u64 *p_single_size,u64 *p_double_size, +u64 *p_linear_size); +bool mlxsw_core_res_valid (struct mlxsw_core *mlxsw_core,enum mlxsw_res_id res_id);
drivers/net/ethernet/mellanox/mlxsw/pci.c +10 -30
@@ -1053,38 +1053,18 @@ static int mlxsw_pci_resources_query(struct mlxsw_pci *mlxsw_pci, char *mbox, }static int -mlxsw_pci_profile_get_kvd_sizes (const struct mlxsw_config_profile *profile, +mlxsw_pci_profile_get_kvd_sizes (const struct mlxsw_pci *mlxsw_pci, +const struct mlxsw_config_profile *profile,struct mlxsw_res *res) { -u32 single_size, double_size, linear_size; - -if (!MLXSW_RES_VALID (res,KVD_SINGLE_MIN_SIZE ) || - !MLXSW_RES_VALID (res,KVD_DOUBLE_MIN_SIZE ) || - !profile->used_kvd_split_data) -return -EIO ; - - linear_size = profile->kvd_linear_size; +u64 single_size, double_size, linear_size; +int err; -/* The hash part is what left of the kvd without the -* linear part. It is split to the single size and -* double size by the parts ratio from the profile. -* Both sizes must be a multiplications of the -* granularity from the profile. -*/ - double_size =MLXSW_RES_GET (res,KVD_SIZE ) - linear_size; - double_size *= profile->kvd_hash_double_parts; - double_size /= profile->kvd_hash_double_parts + - profile->kvd_hash_single_parts; - double_size /= profile->kvd_hash_granularity; - double_size *= profile->kvd_hash_granularity; - single_size =MLXSW_RES_GET (res,KVD_SIZE ) - double_size - - linear_size; - -/* Check results are legal. */ -if (single_size <MLXSW_RES_GET (res,KVD_SINGLE_MIN_SIZE ) || - double_size <MLXSW_RES_GET (res,KVD_DOUBLE_MIN_SIZE ) || -MLXSW_RES_GET (res,KVD_SIZE ) < linear_size) -return -EIO ; + err =mlxsw_core_kvd_sizes_get (mlxsw_pci->core, profile, + &single_size, &double_size, + &linear_size); +if (err) +return err;MLXSW_RES_SET (res,KVD_SINGLE_SIZE , single_size);MLXSW_RES_SET (res,KVD_DOUBLE_SIZE , double_size);
@@ -1185,7 +1165,7 @@ static int mlxsw_pci_config_profile(struct mlxsw_pci *mlxsw_pci, char *mbox, mbox, profile->adaptive_routing_group_cap); }if (MLXSW_RES_VALID (res,KVD_SIZE )) { - err =mlxsw_pci_profile_get_kvd_sizes (profile, res); + err =mlxsw_pci_profile_get_kvd_sizes (mlxsw_pci, profile, res);if (err)return err;
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +57 -0
69 lines not on this page · raw message
Signature · 1 line
2.9.5
Jiri Pirko
maintainerPATCH v2 10/10 mlxsw: core: Add support for reload
In reply to Jiri PirkoFrom: Arkadi Sharshevsky <[email protected]>
Add support for hot reload. First, all the driver/core resources are released but the PCI and devlink instances, then reset is performed through the PCI interface. Finally the driver performs initialization.
In case of reload failure the driver is left in a partially initialized state. Special care is taken during the driver removal in order to properly handle this state.
--- drivers/net/ethernet/mellanox/mlxsw/core.c | 64 +++++++++++++++++++++++------- drivers/net/ethernet/mellanox/mlxsw/core.h | 5 ++- drivers/net/ethernet/mellanox/mlxsw/i2c.c | 5 ++- drivers/net/ethernet/mellanox/mlxsw/pci.c | 5 ++- 4 files changed, 59 insertions(+), 20 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core.c +50 -14
@@ -113,6 +113,7 @@ struct mlxsw_core {struct mlxsw_thermal *thermal;struct mlxsw_core_port *ports;unsigned int max_ports; +bool reload_fail;unsigned long driver_priv[0 ];/* driver_priv has to be always the last item */ };
@@ -962,7 +963,28 @@ mlxsw_devlink_sb_occ_tc_port_bind_get(struct devlink_port *devlink_port, pool_type, p_cur, p_max); } +static int mlxsw_devlink_core_bus_device_reload (struct devlink *devlink) +{ +struct mlxsw_core *mlxsw_core =devlink_priv (devlink); +const struct mlxsw_bus *mlxsw_bus = mlxsw_core->bus; +int err; + +if (!mlxsw_bus->reset) +return -EOPNOTSUPP ; + +mlxsw_core_bus_device_unregister (mlxsw_core, true); + mlxsw_bus->reset (mlxsw_core->bus_priv); + err =mlxsw_core_bus_device_register (mlxsw_core->bus_info, + mlxsw_core->bus, + mlxsw_core->bus_priv, true, + devlink); +if (err) + mlxsw_core->reload_fail = true; +return err; +} +static const struct devlink_ops mlxsw_devlink_ops = { + .reload = mlxsw_devlink_core_bus_device_reload, .port_type_set = mlxsw_devlink_port_type_set, .port_split = mlxsw_devlink_port_split, .port_unsplit = mlxsw_devlink_port_unsplit,
@@ -980,23 +1002,26 @@ static const struct devlink_ops mlxsw_devlink_ops = {int mlxsw_core_bus_device_register (const struct mlxsw_bus_info *mlxsw_bus_info,const struct mlxsw_bus *mlxsw_bus, -void *bus_priv) +void *bus_priv,bool reload, +struct devlink *devlink) {const char *device_kind = mlxsw_bus_info->device_kind;struct mlxsw_core *mlxsw_core;struct mlxsw_driver *mlxsw_driver; -struct devlink *devlink;size_t alloc_size;int err; mlxsw_driver =mlxsw_core_driver_get (device_kind);if (!mlxsw_driver)return -EINVAL ; - alloc_size =sizeof (*mlxsw_core) + mlxsw_driver->priv_size; - devlink =devlink_alloc (&mlxsw_devlink_ops, alloc_size); -if (!devlink) { - err = -ENOMEM ; - goto err_devlink_alloc; + +if (!reload) { + alloc_size =sizeof (*mlxsw_core) + mlxsw_driver->priv_size; + devlink =devlink_alloc (&mlxsw_devlink_ops, alloc_size); +if (!devlink) { + err = -ENOMEM ; + goto err_devlink_alloc; + } } mlxsw_core =devlink_priv (devlink);
@@ -1012,7 +1037,7 @@ int mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info,if (err) goto err_bus_init; -if (mlxsw_driver->resources_register) { +if (mlxsw_driver->resources_register && !reload) { err = mlxsw_driver->resources_register (mlxsw_core);if (err) goto err_register_resources;
@@ -1038,9 +1063,11 @@ int mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info,if (err) goto err_emad_init; - err =devlink_register (devlink, mlxsw_bus_info->dev); -if (err) - goto err_devlink_register; +if (!reload) { + err =devlink_register (devlink, mlxsw_bus_info->dev); +if (err) + goto err_devlink_register; + } err =mlxsw_hwmon_init (mlxsw_core, mlxsw_bus_info, &mlxsw_core->hwmon);if (err)
@@ -1082,20 +1109,29 @@ int mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info, }EXPORT_SYMBOL (mlxsw_core_bus_device_register); -void mlxsw_core_bus_device_unregister (struct mlxsw_core *mlxsw_core) +void mlxsw_core_bus_device_unregister (struct mlxsw_core *mlxsw_core, +bool reload) {const char *device_kind = mlxsw_core->bus_info->device_kind;struct devlink *devlink =priv_to_devlink (mlxsw_core); +if (mlxsw_core->reload_fail) + goto out; +if (mlxsw_core->driver->fini) mlxsw_core->driver->fini (mlxsw_core);mlxsw_thermal_fini (mlxsw_core->thermal); -devlink_unregister (devlink); +if (!reload) +devlink_unregister (devlink);mlxsw_emad_fini (mlxsw_core);kfree (mlxsw_core->lag.mapping);mlxsw_ports_fini (mlxsw_core); -devlink_resources_unregister (devlink,NULL ); +if (!reload) +devlink_resources_unregister (devlink,NULL ); mlxsw_core->bus->fini (mlxsw_core->bus_priv); +if (reload) +return ; +out:devlink_free (devlink);mlxsw_core_driver_put (device_kind); }
drivers/net/ethernet/mellanox/mlxsw/core.h +3 -2
@@ -66,8 +66,9 @@ void mlxsw_core_driver_unregister(struct mlxsw_driver *mlxsw_driver);int mlxsw_core_bus_device_register (const struct mlxsw_bus_info *mlxsw_bus_info,const struct mlxsw_bus *mlxsw_bus, -void *bus_priv); -void mlxsw_core_bus_device_unregister (struct mlxsw_core *mlxsw_core); +void *bus_priv,bool reload, +struct devlink *devlink); +void mlxsw_core_bus_device_unregister (struct mlxsw_core *mlxsw_core,bool reload);struct mlxsw_tx_info {u8 local_port;
drivers/net/ethernet/mellanox/mlxsw/i2c.c +3 -2
@@ -539,7 +539,8 @@ static int mlxsw_i2c_probe(struct i2c_client *client, mlxsw_i2c->dev = &client->dev; err =mlxsw_core_bus_device_register (&mlxsw_i2c->bus_info, - &mlxsw_i2c_bus, mlxsw_i2c); + &mlxsw_i2c_bus, mlxsw_i2c, false, +NULL );if (err) {dev_err (&client->dev,"Fail to register core bus\n" );return err;
@@ -557,7 +558,7 @@ static int mlxsw_i2c_remove(struct i2c_client *client) {struct mlxsw_i2c *mlxsw_i2c =i2c_get_clientdata (client); -mlxsw_core_bus_device_unregister (mlxsw_i2c->core); +mlxsw_core_bus_device_unregister (mlxsw_i2c->core, false);mutex_destroy (&mlxsw_i2c->cmd.lock);return 0 ;
drivers/net/ethernet/mellanox/mlxsw/pci.c +3 -2
@@ -1734,7 +1734,8 @@ static int mlxsw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) mlxsw_pci->id = id; err =mlxsw_core_bus_device_register (&mlxsw_pci->bus_info, - &mlxsw_pci_bus, mlxsw_pci); + &mlxsw_pci_bus, mlxsw_pci, false, +NULL );if (err) {dev_err (&pdev->dev,"cannot register bus device\n" ); goto err_bus_device_register;
@@ -1762,7 +1763,7 @@ static void mlxsw_pci_remove(struct pci_dev *pdev) {struct mlxsw_pci *mlxsw_pci =pci_get_drvdata (pdev); -mlxsw_core_bus_device_unregister (mlxsw_pci->core); +mlxsw_core_bus_device_unregister (mlxsw_pci->core, false);mlxsw_pci_free_irq_vectors (mlxsw_pci);iounmap (mlxsw_pci->hw_addr);pci_release_regions (mlxsw_pci->pdev);
Signature · 1 line
2.9.5
Quoted 15 lines · Jiri Pirko
From: Jiri Pirko <[email protected]>
Many of the ASIC's internal resources are limited and are shared between several hardware procedures. For example, unified hash-based memory can be used for many lookup purposes, like FDB and LPM. In many cases the user can provide a partitioning scheme for such a resource in order to perform fine tuning for his application. In such cases performing driver reload is needed for the changes to take place, thus this patchset also adds support for hot reload.
Such an abstraction can be coupled with devlink's dpipe interface, which models the ASIC's pipeline as a graph of match/action tables. By modeling the hardware resource object, and by coupling it to several dpipe tables, further visibility can be achieved in order to debug ASIC-wide issues.
Quoted 4 lines
The proposed interface will provide the user the ability to understand the limitations of the hardware, and receive notification regarding its occupancy. Furthermore, monitoring the resource occupancy can be done in real-time and can be useful in many cases.
In the last RFC (not v1, but RFC) I asked for some kind of description for each resource, and you and Arkadi have pushed back. Let's walk through an example to see what I mean:
$ devlink resource show pci/0000:03:00.0
pci/0000:03:00.0:
name kvd size 245760 size_valid true
resources:
name linear size 98304 occ 0
name hash_double size 60416
name hash_single size 87040So this 2700 has 3 resources that can be managed -- some table or resource or something named 'kvd' with linear, hash_double and hash_single sub-resources. What are these names referring too? The above output gives no description, and 'kvd' is not an industry term. Further, what are these sizes that a user can control? The output contains no units, no description, nothing. In short, the above output provides random numbers associated with random names.
I can see dpipe tables exported by this device:
$ devlink dpipe header show pci/0000:03:00.0
pci/0000:03:00.0:
name mlxsw_meta
field:
name erif_port bitwidth 32 mapping_type ifindex name l3_forward bitwidth 1
name l3_drop bitwidth 1
name adj_index bitwidth 32
name adj_size bitwidth 32
name adj_hash_index bitwidth 32
name ipv6
field:
name destination ip bitwidth 128
name ipv4
field:
name destination ip bitwidth 32
name ethernet
field:
name destination mac bitwidth 48
but none mention 'kvd' or 'linear' or 'hash" and none of the other various devlink options:
$ devlink
Usage: devlink [ OPTIONS ] OBJECT { COMMAND | help }
where OBJECT := { dev | port | sb | monitor | dpipe }seem to related to resources.
So how does a user know what they are controlling by this 'resource' option? Is the user expected to have a PRM or user guide on hand for the specific device model that is being configured?
Again, I have no objections to kvd, linear, hash, etc terms as they do relate to Mellanox products. But kvd/linear, for example, does correlate to industry standard concepts in some way. My request is that the resource listing guide the user in some way, stating what these resources mean.
IMO the above output is not user friendly and having to keep a PRM on hand for each device model is not a realistic solution.
Jiri Pirko
maintainerQuoted 33 lines · Wed, Dec 27, 2017 at 05:05:09AM CET, [email protected] wrote:
Quoted 15 lines · Jiri Pirko
From: Jiri Pirko <[email protected]>
Many of the ASIC's internal resources are limited and are shared between several hardware procedures. For example, unified hash-based memory can be used for many lookup purposes, like FDB and LPM. In many cases the user can provide a partitioning scheme for such a resource in order to perform fine tuning for his application. In such cases performing driver reload is needed for the changes to take place, thus this patchset also adds support for hot reload.
Such an abstraction can be coupled with devlink's dpipe interface, which models the ASIC's pipeline as a graph of match/action tables. By modeling the hardware resource object, and by coupling it to several dpipe tables, further visibility can be achieved in order to debug ASIC-wide issues.
Quoted 4 lines
The proposed interface will provide the user the ability to understand the limitations of the hardware, and receive notification regarding its occupancy. Furthermore, monitoring the resource occupancy can be done in real-time and can be useful in many cases.
In the last RFC (not v1, but RFC) I asked for some kind of description for each resource, and you and Arkadi have pushed back. Let's walk through an example to see what I mean:
$ devlink resource show pci/0000:03:00.0 pci/0000:03:00.0: name kvd size 245760 size_valid true resources: name linear size 98304 occ 0 name hash_double size 60416 name hash_single size 87040
Quoted 4 lines
So this 2700 has 3 resources that can be managed -- some table or resource or something named 'kvd' with linear,
hash_doubleandhash_singlesub-resources. What are these names referring too? The above output gives no description, and 'kvd' is not an industry term. Further,
This are internal resources specific to the ASIC. Would you like some description to each or something like that?
Quoted 3 lines
what are these sizes that a user can control? The output contains no units, no description, nothing. In short, the above output provides random numbers associated with random names.
Units are now exposed from kernel, just this version of iproute2 patch does not display it.
Quoted 34 lines
I can see dpipe tables exported by this device:
$ devlink dpipe header show pci/0000:03:00.0pci/0000:03:00.0:
namemlxsw_meta
field:
nameerif_portbitwidth 32mapping_typeifindex namel3_forwardbitwidth 1
namel3_dropbitwidth 1
nameadj_indexbitwidth 32
nameadj_sizebitwidth 32
nameadj_hash_indexbitwidth 32name ipv6
field:
name destination ip bitwidth 128name ipv4
field:
name destination ip bitwidth 32name ethernet
field:
name destination mac bitwidth 48but none mention 'kvd' or 'linear' or 'hash" and none of the other various devlink options:
$ devlink Usage: devlink [ OPTIONS ] OBJECT { COMMAND | help } where OBJECT := { dev | port | sb | monitor | dpipe }
Quoted 5 lines
seem to related to resources.
So how does a user know what they are controlling by this 'resource' option? Is the user expected to have a PRM or user guide on hand for the specific device model that is being configured?
The relation of specific dpipe table to specific resource is exposed by the kernel as well. Probably the iproute2 patch just does not display it.
Quoted 6 lines
Again, I have no objections to kvd, linear, hash, etc terms as they do relate to Mellanox products. But kvd/linear, for example, does correlate to industry standard concepts in some way. My request is that the resource listing guide the user in some way, stating what these resources mean.
So the showed relation to dpipe table would be enougn or you would still like to see some description? I don't like the description concept here as the relations to dpipe table should tell user exactly what he needs to know.
Quoted 3 lines
IMO the above output is not user friendly and having to keep a PRM on hand for each device model is not a realistic solution.
Quoted 8 lines
Quoted 8 lines
$ devlink resource show pci/0000:03:00.0 pci/0000:03:00.0: name kvd size 245760 size_valid true resources: name linear size 98304 occ 0 name hash_double size 60416 name hash_single size 87040
Quoted 7 lines
Quoted 4 lines
So this 2700 has 3 resources that can be managed -- some table or resource or something named 'kvd' with linear,
hash_doubleandhash_singlesub-resources. What are these names referring too? The above output gives no description, and 'kvd' is not an industry term. Further,This are internal resources specific to the ASIC. Would you like some description to each or something like that?
The fact you have decided to expose them means you expect people to change them. So yes, they need to be documented. Maybe add something to Documentation/ABI/stable/
Quoted 4 lines
So the showed relation to dpipe table would be enougn or you would still like to see some description? I don't like the description concept here as the relations to dpipe table should tell user exactly what he needs to know.
Documenting the ABI is good practice.
Andrew
Jiri Pirko
maintainerQuoted 20 lines · Wed, Dec 27, 2017 at 09:23:31AM CET, [email protected] wrote:
Quoted 8 lines
Quoted 8 lines
$ devlink resource show pci/0000:03:00.0 pci/0000:03:00.0: name kvd size 245760 size_valid true resources: name linear size 98304 occ 0 name hash_double size 60416 name hash_single size 87040Quoted 7 lines
Quoted 4 lines
So this 2700 has 3 resources that can be managed -- some table or resource or something named 'kvd' with linear,
hash_doubleandhash_singlesub-resources. What are these names referring too? The above output gives no description, and 'kvd' is not an industry term. Further,This are internal resources specific to the ASIC. Would you like some description to each or something like that?
The fact you have decided to expose them means you expect people to change them. So yes, they need to be documented. Maybe add something to
Documentation/ABI/stable/
Quoted 6 lines
Quoted 4 lines
So the showed relation to dpipe table would be enougn or you would still like to see some description? I don't like the description concept here as the relations to dpipe table should tell user exactly what he needs to know.
Documenting the ABI is good practice.
This is misunderstanding I believe. This is not about ABI. That is well defined by the netlink attributes. This is about meaning of particular ASIC-specific internal resources.
Quoted 3 lines
Andrew
Quoted 3 lines
This is misunderstanding I believe. This is not about ABI. That is well defined by the netlink attributes. This is about meaning of particular ASIC-specific internal resources.
I would agree that the netlink attributed are clearly defined. But the meta information, what this ASIC specific internal resource means when you combine these attributes, is unclear. This meta information is also part of the ABI, and documenting giving users a hit what it means, and why they should change it, would be good practice.
Look at sysfs. open/read/write are clearly defined, which is the equivalent of the netlink attributes. The meta information we document in Documentation/ABI/, what a file name means, what a value means, what other values it can take, etc.
Andrew
Jiri Pirko
maintainerQuoted 10 lines · Wed, Dec 27, 2017 at 02:08:03PM CET, [email protected] wrote:
Quoted 3 lines
This is misunderstanding I believe. This is not about ABI. That is well defined by the netlink attributes. This is about meaning of particular ASIC-specific internal resources.
I would agree that the netlink attributed are clearly defined. But the meta information, what this ASIC specific internal resource means when you combine these attributes, is unclear. This meta information is also part of the ABI, and documenting giving users a hit what it means, and why they should change it, would be good practice.
Quoted 4 lines
Look at sysfs. open/read/write are clearly defined, which is the equivalent of the netlink attributes. The meta information we document in
Documentation/ABI/, what a file name means, what a value means, what other values it can take, etc.
Hmm. That documents mainly sysfs. No mention of Netlink at all. But maybe I missed it. Also, that defines the interface as is. However we are talking about the data exchanged over the interface, not the interface itself. I don't see how ASIC/HW specific thing, like for example KVD in our case could be part of kernel ABI. That makes 0 sense to me, sorry.
Quoted 16 lines · Jiri Pirko
Quoted 10 lines · Wed, Dec 27, 2017 at 02:08:03PM CET, [email protected] wrote:
Quoted 3 lines
This is misunderstanding I believe. This is not about ABI. That is well defined by the netlink attributes. This is about meaning of particular ASIC-specific internal resources.
I would agree that the netlink attributed are clearly defined. But the meta information, what this ASIC specific internal resource means when you combine these attributes, is unclear. This meta information is also part of the ABI, and documenting giving users a hit what it means, and why they should change it, would be good practice.
Quoted 4 lines
Look at sysfs. open/read/write are clearly defined, which is the equivalent of the netlink attributes. The meta information we document in
Documentation/ABI/, what a file name means, what a value means, what other values it can take, etc.
Quoted 7 lines
Hmm. That documents mainly sysfs. No mention of Netlink at all. But maybe I missed it. Also, that defines the interface as is. However we are talking about the data exchanged over the interface, not the interface itself. I don't see how ASIC/HW specific thing, like for example KVD in our case could be part of kernel ABI. That makes 0 sense to me, sorry.
IMO, kernel documentation is not much better than vendor docs. A general networking admin may not have access to a kernel tree or have vendor docs at their finger tips. As I mentioned in the previous response, devlink attributes have self-documenting capabilities making that information available inline. That to me is the right place for a short, but reasonably sized description. For in-depth details users can cross-reference vendor docs.
Quoted 5 lines
Hmm. That documents mainly sysfs. No mention of Netlink at all. But maybe I missed it. Also, that defines the interface as is. However we are talking about the data exchanged over the interface, not the interface itself. I don't see how ASIC/HW specific thing, like for example KVD in our case could be part of kernel ABI.
You need to be very careful here. As soon as somebody starts using it, it might become an ABI. Or you need to clearly document it is not ABI, there is no guarantee it will not disappear or change its meaning in the next kernel, and it should be used with extreme caution.
Personally, if DSA drivers were to expose such settings, i would consider them ABI, which people can rely on to remain stable.
Andrew
Quoted 11 lines · Andrew Lunn
Quoted 5 lines
Hmm. That documents mainly sysfs. No mention of Netlink at all. But maybe I missed it. Also, that defines the interface as is. However we are talking about the data exchanged over the interface, not the interface itself. I don't see how ASIC/HW specific thing, like for example KVD in our case could be part of kernel ABI.
You need to be very careful here. As soon as somebody starts using it, it might become an ABI. Or you need to clearly document it is not ABI, there is no guarantee it will not disappear or change its meaning in the next kernel, and it should be used with extreme caution.
+1
Once the names go in, people can write scripts that invoke devlink at boot to partition resources. With the proposed patch set, the name (e.g., kvd/linear) becomes part of the ABI.
Quoted 87 lines
Quoted 2 lines
Quoted 2 lines
Many of the ASIC's internal resources are limited and are shared between several hardware procedures. For example, unified hash-based memory
can
Quoted 1 line
Quoted 1 line
be used for many lookup purposes, like FDB and LPM. In many cases the
user
Quoted 5 lines
Quoted 5 lines
can provide a partitioning scheme for such a resource in order to perform fine tuning for his application. In such cases performing driver reload is needed for the changes to take place, thus this patchset also adds support for hot reload.
Quoted 7 lines
Quoted 7 lines
Such an abstraction can be coupled with devlink's dpipe interface, which models the ASIC's pipeline as a graph of match/action tables. By modeling the hardware resource object, and by coupling it to several dpipe tables, further visibility can be achieved in order to debug ASIC-wide issues.
The proposed interface will provide the user the ability to understand the limitations of the hardware, and receive notification regarding its
occupancy.
Quoted 1 line
Quoted 1 line
Furthermore, monitoring the resource occupancy can be done in real-time
and
Quoted 14 lines
Quoted 1 line
can be useful in many cases.
In the last RFC (not v1, but RFC) I asked for some kind of description for each resource, and you and Arkadi have pushed back. Let's walk through an example to see what I mean:
$ devlink resource show pci/0000:03:00.0 pci/0000:03:00.0: name kvd size 245760 size_valid true resources: name linear size 98304 occ 0 name hash_double size 60416 name hash_single size 87040Quoted 4 lines
So this 2700 has 3 resources that can be managed -- some table or resource or something named 'kvd' with linear,
hash_doubleandhash_singlesub-resources. What are these names referring too? The above output gives no description, and 'kvd' is not an industry term. Further,This are internal resources specific to the ASIC. Would you like some description to each or something like that?
Quoted 3 lines
what are these sizes that a user can control? The output contains no units, no description, nothing. In short, the above output provides random numbers associated with random names.
Units are now exposed from kernel, just this version of iproute2 patch does not display it.
Quoted 36 lines
I can see dpipe tables exported by this device:
$ devlink dpipe header show pci/0000:03:00.0pci/0000:03:00.0:
namemlxsw_meta
field:
nameerif_portbitwidth 32mapping_typeifindex namel3_forwardbitwidth 1
namel3_dropbitwidth 1
nameadj_indexbitwidth 32
nameadj_sizebitwidth 32
nameadj_hash_indexbitwidth 32name ipv6
field:
name destination ip bitwidth 128name ipv4
field:
name destination ip bitwidth 32name ethernet
field:
name destination mac bitwidth 48but none mention 'kvd' or 'linear' or 'hash" and none of the other various devlink options:
$ devlink Usage: devlink [ OPTIONS ] OBJECT { COMMAND | help } where OBJECT := { dev | port | sb | monitor | dpipe }seem to related to resources.
Quoted 7 lines
Quoted 3 lines
So how does a user know what they are controlling by this 'resource' option? Is the user expected to have a PRM or user guide on hand for the specific device model that is being configured?
The relation of specific dpipe table to specific resource is exposed by the kernel as well. Probably the iproute2 patch just does not display it.
It does, just under 'table' and not under 'header'. E.g.:
# ./devlink/devlink dpipe -j -p table show pci/0000:03:00.0
...
},{
"resource_path": "/kvd/hash_single",
"name": "mlxsw_host4",
"size": 0,
"counters_enabled": "false",
"match": [{
"type": "field_exact",
"header": "mlxsw_meta",
"field": "erif_port",
"mapping": "ifindex"
},{
"type": "field_exact",
"header": "ipv4",
"field": "destination ip"
}
],
"action": [{
"type": "field_modify",
"header": "ethernet",
"field": "destination mac"
}
]
},{
...Quoted 18 lines
Quoted 8 lines
Again, I have no objections to kvd, linear, hash, etc terms as they do relate to Mellanox products. But kvd/linear, for example, does correlate to industry standard concepts in some way. My request is that the resource listing guide the user in some way, stating what these resources mean.
So the showed relation to dpipe table would be enougn or you would still like to see some description? I don't like the description concept here as the relations to dpipe table should tell user exactly what he needs to know.
Quoted 3 lines
IMO the above output is not user friendly and having to keep a PRM on hand for each device model is not a realistic solution.
Quoted 34 lines · Jiri Pirko
Quoted 33 lines · Wed, Dec 27, 2017 at 05:05:09AM CET, [email protected] wrote:
Quoted 15 lines · Jiri Pirko
From: Jiri Pirko <[email protected]>
Many of the ASIC's internal resources are limited and are shared between several hardware procedures. For example, unified hash-based memory can be used for many lookup purposes, like FDB and LPM. In many cases the user can provide a partitioning scheme for such a resource in order to perform fine tuning for his application. In such cases performing driver reload is needed for the changes to take place, thus this patchset also adds support for hot reload.
Such an abstraction can be coupled with devlink's dpipe interface, which models the ASIC's pipeline as a graph of match/action tables. By modeling the hardware resource object, and by coupling it to several dpipe tables, further visibility can be achieved in order to debug ASIC-wide issues.
Quoted 4 lines
The proposed interface will provide the user the ability to understand the limitations of the hardware, and receive notification regarding its occupancy. Furthermore, monitoring the resource occupancy can be done in real-time and can be useful in many cases.
In the last RFC (not v1, but RFC) I asked for some kind of description for each resource, and you and Arkadi have pushed back. Let's walk through an example to see what I mean:
$ devlink resource show pci/0000:03:00.0 pci/0000:03:00.0: name kvd size 245760 size_valid true resources: name linear size 98304 occ 0 name hash_double size 60416 name hash_single size 87040
Quoted 7 lines
Quoted 4 lines
So this 2700 has 3 resources that can be managed -- some table or resource or something named 'kvd' with linear,
hash_doubleandhash_singlesub-resources. What are these names referring too? The above output gives no description, and 'kvd' is not an industry term. Further,This are internal resources specific to the ASIC. Would you like some description to each or something like that?
devlink has some nice self-documenting capabilities. What's missing here is a description of what the resource is used for in standard terms -- ipv4 host routes, fdb, nexthops, rifs, etc. Even if the description is a short list versus an exhaustive list of everything it is used for. e.g., Why would a user decrease linear and increase hash_single or vice versa?
Quoted 8 lines
Quoted 5 lines
what are these sizes that a user can control? The output contains no units, no description, nothing. In short, the above output provides random numbers associated with random names.
Units are now exposed from kernel, just this version of iproute2 patch does not display it.
please provide an iproute2 patch that does so the full context if this patch set can be reviewed from a user perspective.
Quoted 38 lines
Quoted 38 lines
I can see dpipe tables exported by this device:
$ devlink dpipe header show pci/0000:03:00.0pci/0000:03:00.0:
namemlxsw_meta
field:
nameerif_portbitwidth 32mapping_typeifindex namel3_forwardbitwidth 1
namel3_dropbitwidth 1
nameadj_indexbitwidth 32
nameadj_sizebitwidth 32
nameadj_hash_indexbitwidth 32name ipv6
field:
name destination ip bitwidth 128name ipv4
field:
name destination ip bitwidth 32name ethernet
field:
name destination mac bitwidth 48but none mention 'kvd' or 'linear' or 'hash" and none of the other various devlink options:
$ devlink Usage: devlink [ OPTIONS ] OBJECT { COMMAND | help } where OBJECT := { dev | port | sb | monitor | dpipe }seem to related to resources.
Quoted 7 lines
Quoted 3 lines
So how does a user know what they are controlling by this 'resource' option? Is the user expected to have a PRM or user guide on hand for the specific device model that is being configured?
The relation of specific dpipe table to specific resource is exposed by the kernel as well. Probably the iproute2 patch just does not display it.
please provide an iproute2 patch that does so the full context if this patch set can be reviewed from a user perspective.
Quoted 9 lines
Quoted 8 lines
Again, I have no objections to kvd, linear, hash, etc terms as they do relate to Mellanox products. But kvd/linear, for example, does correlate to industry standard concepts in some way. My request is that the resource listing guide the user in some way, stating what these resources mean.
Quoted 4 lines
So the showed relation to dpipe table would be enougn or you would still like to see some description? I don't like the description concept here as the relations to dpipe table should tell user exactly what he needs to know.
I believe it is useful to have a 1-line, short description that gives the user some memory jogger as to what the resource is used for. It does not have to be an exhaustive list, but the user should not have to do mental jumping jacks running a bunch of commands to understand the resources for vendor specific asics.
Quoted 40 lines · David Ahern
Quoted 39 lines · Jiri Pirko
Quoted 37 lines · Wed, Dec 27, 2017 at 05:05:09AM CET, [email protected] wrote:
Quoted 15 lines · Jiri Pirko
From: Jiri Pirko <[email protected]>
Many of the ASIC's internal resources are limited and are shared between several hardware procedures. For example, unified hash-based memory can be used for many lookup purposes, like FDB and LPM. In many cases the user can provide a partitioning scheme for such a resource in order to perform fine tuning for his application. In such cases performing driver reload is needed for the changes to take place, thus this patchset also adds support for hot reload.
Such an abstraction can be coupled with devlink's dpipe interface, which models the ASIC's pipeline as a graph of match/action tables. By modeling the hardware resource object, and by coupling it to several dpipe tables, further visibility can be achieved in order to debug ASIC-wide issues.
Quoted 4 lines
The proposed interface will provide the user the ability to understand the limitations of the hardware, and receive notification regarding its occupancy. Furthermore, monitoring the resource occupancy can be done in real-time and can be useful in many cases.
In the last RFC (not v1, but RFC) I asked for some kind of description for each resource, and you and Arkadi have pushed back. Let's walk through an example to see what I mean:
$ devlink resource show pci/0000:03:00.0 pci/0000:03:00.0: name kvd size 245760 size_valid true resources: name linear size 98304 occ 0 name hash_double size 60416 name hash_single size 87040So this 2700 has 3 resources that can be managed -- some table or resource or something named 'kvd' with linear,
hash_doubleandhash_singlesub-resources. What are these names referring too? The above output gives no description, and 'kvd' is not an industry term. Further,
Quoted 8 lines
Quoted 2 lines
This are internal resources specific to the ASIC. Would you like some description to each or something like that?
devlink has some nice self-documenting capabilities. What's missing here is a description of what the resource is used for in standard terms -- ipv4 host routes, fdb, nexthops, rifs, etc. Even if the description is a short list versus an exhaustive list of everything it is used for. e.g., Why would a user decrease linear and increase
hash_singleor vice versa?
Arkadi, on what david says above, can the resource names and ids not be driver specific, but moved up to the switchdev layer and just map to fdb, host routes, nexthops table sizes etc ?.
Can these generic networking resources then in-turn be mapped to kvd sizes by the driver ?
Quoted 55 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Many of the ASIC's internal resources are limited and are shared
between
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
several hardware procedures. For example, unified hash-based memory
can
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
be used for many lookup purposes, like FDB and LPM. In many cases the
user
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
can provide a partitioning scheme for such a resource in order to
perform
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
fine tuning for his application. In such cases performing driver reload is needed for the changes to take place, thus this patchset also adds
support
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
for hot reload.
Such an abstraction can be coupled with devlink's dpipe interface, which models the ASIC's pipeline as a graph of match/action tables. By
modeling
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
the hardware resource object, and by coupling it to several dpipe tables, further visibility can be achieved in order to debug ASIC-wide issues.
The proposed interface will provide the user the ability to understand
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
limitations of the hardware, and receive notification regarding its
occupancy.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Furthermore, monitoring the resource occupancy can be done in real-
time and
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 1 line
can be useful in many cases.
In the last RFC (not v1, but RFC) I asked for some kind of description for each resource, and you and Arkadi have pushed back. Let's walk through an example to see what I mean:
$ devlink resource show pci/0000:03:00.0 pci/0000:03:00.0: name kvd size 245760 size_valid true resources: name linear size 98304 occ 0 name hash_double size 60416 name hash_single size 87040Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
So this 2700 has 3 resources that can be managed -- some table or resource or something named 'kvd' with linear,
hash_doubleandhash_singlesub-resources. What are these names referring too? Theabove
Quoted 10 lines
Quoted 4 lines
Quoted 1 line
output gives no description, and 'kvd' is not an industry term. Further,
This are internal resources specific to the ASIC. Would you like some description to each or something like that?
devlink has some nice self-documenting capabilities. What's missing here is a description of what the resource is used for in standard terms -- ipv4 host routes, fdb, nexthops, rifs, etc. Even if the description is a short list versus an exhaustive list of everything it is used for. e.g., Why would a user decrease linear and increase
hash_singleor vice versa?
Quoted 5 lines
Arkadi, on what david says above, can the resource names and ids not be driver specific, but moved up to the switchdev layer and just map to fdb, host routes, nexthops table sizes etc ?.
Can these generic networking resources then in-turn be mapped to kvd sizes by the driver ?
I think it goes the other way around. The dpipe tables are the ones that can be translated to functionality; The resources are internal and HW-specific representing the possible internal division of resources -
but a given resource sn't necessarily mapped to a single networking feature. [It might be in some cases, but not in the general case]
You could always move to a structured approach where each resource in the hierarchy is further split to sub-resources until each leaf represents a single network concepts - but that would stop be an abstraction of the HW resources and become a SW implementation instead, as SW would have to be the one to maintain and enforce the resource distribution. And that's not what we're trying to achieve here.
Quoted 5 lines · Yuval Mintz
I think it goes the other way around. The dpipe tables are the ones that can be translated to functionality; The resources are internal and HW-specific representing the possible internal division of resources -
but a given resource sn't necessarily mapped to a single networking feature. [It might be in some cases, but not in the general case]
This is what I am getting at -- a single resource /kvd/linear is used for multiple networking features, and those networking features do map to well known entities -- fdb entries, ACL entries, ipv4/v6 host entries, LPM entries, etc.
Nothing about the output from devlink helps the user in any way to understand how to change the resource values. Saying that these resources, what they mean and how they are used is MLX proprietary and is known only to MLX employees and those with MLX agreements is not acceptable. Likewise, requiring some network admin to deep dive into the mlxsw driver to piece together how kvd/linear (for example) is used is not acceptable.
The cover letter touts "Many of the ASIC's internal resources are limited and are shared between several hardware procedures. For example, unified hash-based memory can be used for many lookup purposes, like FDB and LPM. In many cases the user can provide a partitioning scheme for such a resource in order to perform fine tuning for his application."
Great, now give the user some indication of how to do that. Is setting /kvd/linear to 0 acceptable? If not, why? What functionality is lost? (Apparently, everything [1].)
The dpipe tables list some correlation between the kvd resources and tables but that is not a complete list and again there is nothing to tell a user that it is only a partial list of how a kvd resource is used. For example, it shows ipv4 host is in /kvd/hash_single and that is all it shows. So if I have an ipv6 only deployment can I conclude that I can set /kvd/hash_single to 0? Or the reverse, can I set hash_double to 0 for an ipv4 only deployment? From the limited information given, it is reasonable for a user to assume yes and has to learn through trial and error what can be done. [2]
-----
[1] This is allowed by the current patch set and perhaps it should not be:
$ ip ro ls vrf vrf1101 unreachable default metric 8192 11.2.51.0/24 dev swp1s0.51 proto kernel scope link src 11.2.51.1 offload 11.3.51.0/24 dev swp1s1.51 proto kernel scope link src 11.3.51.1 offload 11.4.51.0/24 dev swp1s2.51 proto kernel scope link src 11.4.51.1 offload 11.5.51.0/24 dev swp1s3.51 proto kernel scope link src 11.5.51.1 offload 11.6.51.0/24 dev swp3s0.51 proto kernel scope link src 11.6.51.1 offload 11.7.51.0/24 dev swp3s1.51 proto kernel scope link src 11.7.51.1 offload 11.8.51.0/24 dev swp3s2.51 proto kernel scope link src 11.8.51.1 offload 11.9.51.0/24 dev swp3s3.51 proto kernel scope link src 11.9.51.1 offload
$ devlink resource set pci/0000:03:00.0 path /kvd/linear size 0 $ devlink reload pci/0000:03:00.0 $ ip ro ls vrf vrf1101 unreachable default metric 8192
[2] Same exact result for setting hash_double to 0:
$ ip ro ls vrf vrf1101 unreachable default metric 8192 11.2.51.0/24 dev swp1s0.51 proto kernel scope link src 11.2.51.1 offload 11.3.51.0/24 dev swp1s1.51 proto kernel scope link src 11.3.51.1 offload 11.4.51.0/24 dev swp1s2.51 proto kernel scope link src 11.4.51.1 offload 11.5.51.0/24 dev swp1s3.51 proto kernel scope link src 11.5.51.1 offload 11.6.51.0/24 dev swp3s0.51 proto kernel scope link src 11.6.51.1 offload 11.7.51.0/24 dev swp3s1.51 proto kernel scope link src 11.7.51.1 offload 11.8.51.0/24 dev swp3s2.51 proto kernel scope link src 11.8.51.1 offload 11.9.51.0/24 dev swp3s3.51 proto kernel scope link src 11.9.51.1 offload
$ devlink resource set pci/0000:03:00.0 path /kvd/hash_double size 0 $ devlink reload pci/0000:03:00.0 $ ip ro ls vrf vrf1101 unreachable default metric 8192
Quoted 7 lines · David Ahern
Quoted 5 lines · Yuval Mintz
I think it goes the other way around. The dpipe tables are the ones that can be translated to functionality; The resources are internal and HW-specific representing the possible internal division of resources -
but a given resource sn't necessarily mapped to a single networking feature. [It might be in some cases, but not in the general case]
Quoted 7 lines
This is what I am getting at -- a single resource /kvd/linear is used for multiple networking features, and those networking features do map to well known entities -- fdb entries, ACL entries, ipv4/v6 host entries, LPM entries, etc.
Nothing about the output from devlink helps the user in any way to understand how to change the resource values. Saying that these
The current patchset adds the following dpipe table <--> resource relation
host4 -- hash single
host6 -- hash double
adj -- linear
By dumping the resources via the 'resource show' you can the tree like structure, you can see that you have a tradeoff between those subparts. So for example if a user would like to increase the number of nexthops with the expense of neighbors, it is pretty clear. As more dpipe table will be introduced this relations will be more complete and the user will get the complete view of the ASIC.
Just to summarize, the user gets the following info
1. Constrains\trade off about setting the sizes - this you get by the tree structure.
2. Each hardware process which use this resource is mapped to it
By combining those two you can get the most accurate information about what your change will do. Partitioning of the KVD is very delicate process, because the hardware is complex. Many hardware processes are pointing to this memory and size changes effect the whole ASIC, as I mentioned as more of the pipeline will be exposed via dpipe the user will get a more precise vision of the hardware.
We will provide some recommended and tested configuration of the whole mlxsw resource tree for different user scenarios. A more experienced user can do it for himself, if he got some very special scenario.
Quoted 12 lines
resources, what they mean and how they are used is MLX proprietary and is known only to MLX employees and those with MLX agreements is not acceptable. Likewise, requiring some network admin to deep dive into the mlxsw driver to piece together how kvd/linear (for example) is used is not acceptable.
The cover letter touts "Many of the ASIC's internal resources are limited and are shared between several hardware procedures. For example, unified hash-based memory can be used for many lookup purposes, like FDB and LPM. In many cases the user can provide a partitioning scheme for such a resource in order to perform fine tuning for his application."
Quoted 7 lines
Great, now give the user some indication of how to do that. Is setting /kvd/linear to 0 acceptable? If not, why? What functionality is lost? (Apparently, everything [1].)
The dpipe tables list some correlation between the kvd resources and tables but that is not a complete list and again there is nothing to tell a user that it is only a partial list of how a kvd resource is
This is work in progress, the LPM block will be exposed as the last L3 part. Then we will start the l2 part of the ASIC.
Quoted 7 lines
used. For example, it shows ipv4 host is in /kvd/hash_single and that is all it shows. So if I have an ipv6 only deployment can I conclude that I can set /kvd/hash_single to 0? Or the reverse, can I set
hash_doubleto 0 for an ipv4 only deployment? From the limited information given, it is reasonable for a user to assume yes and has to learn through trial and error what can be done. [2]
So you want to add min/max size attribute? I think this its not needed.
Quoted 15 lines
-----
[1] This is allowed by the current patch set and perhaps it should not be:
$ ip ro ls vrf vrf1101 unreachable default metric 8192 11.2.51.0/24 dev swp1s0.51 proto kernel scope link src 11.2.51.1 offload 11.3.51.0/24 dev swp1s1.51 proto kernel scope link src 11.3.51.1 offload 11.4.51.0/24 dev swp1s2.51 proto kernel scope link src 11.4.51.1 offload 11.5.51.0/24 dev swp1s3.51 proto kernel scope link src 11.5.51.1 offload 11.6.51.0/24 dev swp3s0.51 proto kernel scope link src 11.6.51.1 offload 11.7.51.0/24 dev swp3s1.51 proto kernel scope link src 11.7.51.1 offload 11.8.51.0/24 dev swp3s2.51 proto kernel scope link src 11.8.51.1 offload 11.9.51.0/24 dev swp3s3.51 proto kernel scope link src 11.9.51.1 offload
Quoted 1 line
$ devlink resource set pci/0000:03:00.0 path /kvd/linear size 0
This line actually did nothing, because size zero is not acceptable see patch 6. This is pure userpsace problem that error is not shown.
You can verify it by dumping the resources and see that there is no pending change (only size and not size_new).
Quoted 4 lines
$ devlink reload pci/0000:03:00.0 $ ip ro ls vrf vrf1101 unreachable default metric 8192
So you just performed full reload of the driver which includes unregistration of all the netdevs and full init. KVD update requires full teardown of the driver.
The system will not get back to the same state after reloading, It's should be done on init. But it doesn't have to be like this this, each driver provides his own reload devlink op implementation so in our case full blown reset is required.
Quoted 17 lines
[2] Same exact result for setting
hash_doubleto 0:$ ip ro ls vrf vrf1101 unreachable default metric 8192 11.2.51.0/24 dev swp1s0.51 proto kernel scope link src 11.2.51.1 offload 11.3.51.0/24 dev swp1s1.51 proto kernel scope link src 11.3.51.1 offload 11.4.51.0/24 dev swp1s2.51 proto kernel scope link src 11.4.51.1 offload 11.5.51.0/24 dev swp1s3.51 proto kernel scope link src 11.5.51.1 offload 11.6.51.0/24 dev swp3s0.51 proto kernel scope link src 11.6.51.1 offload 11.7.51.0/24 dev swp3s1.51 proto kernel scope link src 11.7.51.1 offload 11.8.51.0/24 dev swp3s2.51 proto kernel scope link src 11.8.51.1 offload 11.9.51.0/24 dev swp3s3.51 proto kernel scope link src 11.9.51.1 offload$ devlink resource set pci/0000:03:00.0 path /kvd/hash_double size 0 $ devlink reload pci/0000:03:00.0 $ ip ro ls vrf vrf1101 unreachable default metric 8192
Quoted 13 lines · Arkadi Sharshevsky
Quoted 13 lines
[1] This is allowed by the current patch set and perhaps it should not be:
$ ip ro ls vrf vrf1101 unreachable default metric 8192 11.2.51.0/24 dev swp1s0.51 proto kernel scope link src 11.2.51.1 offload 11.3.51.0/24 dev swp1s1.51 proto kernel scope link src 11.3.51.1 offload 11.4.51.0/24 dev swp1s2.51 proto kernel scope link src 11.4.51.1 offload 11.5.51.0/24 dev swp1s3.51 proto kernel scope link src 11.5.51.1 offload 11.6.51.0/24 dev swp3s0.51 proto kernel scope link src 11.6.51.1 offload 11.7.51.0/24 dev swp3s1.51 proto kernel scope link src 11.7.51.1 offload 11.8.51.0/24 dev swp3s2.51 proto kernel scope link src 11.8.51.1 offload 11.9.51.0/24 dev swp3s3.51 proto kernel scope link src 11.9.51.1 offload
Quoted 4 lines
Quoted 1 line
$ devlink resource set pci/0000:03:00.0 path /kvd/linear size 0This line actually did nothing, because size zero is not acceptable see patch 6. This is pure userpsace problem that error is not shown.
Then perhaps you have a kernel side bug. After the reload I get this:
$ devlink resource show pci/0000:03:00.0
pci/0000:03:00.0:
name kvd size 245760 size_valid true
resources:
name linear size 0 occ 0
name hash_double size 60416
name hash_single size 87040Quoted 4 lines
You can verify it by dumping the resources and see that there is no pending change (only size and not
size_new).
Quoted 8 lines
Quoted 4 lines
$ devlink reload pci/0000:03:00.0 $ ip ro ls vrf vrf1101 unreachable default metric 8192So you just performed full reload of the driver which includes unregistration of all the netdevs and full init. KVD update requires full teardown of the driver.
you are right, I forgot to do a networking reload. Because of the above (0 was actually taken) all kinds of errors are spewed on 'ifreload -av' and there is no change to the ro ls:
$ ip ro ls vrf vrf1101 unreachable default metric 8192
Quoted 20 lines
The system will not get back to the same state after reloading, It's should be done on init. But it doesn't have to be like this this, each driver provides his own reload devlink op implementation so in our case full blown reset is required.
Quoted 13 lines
[2] Same exact result for setting
hash_doubleto 0:$ ip ro ls vrf vrf1101 unreachable default metric 8192 11.2.51.0/24 dev swp1s0.51 proto kernel scope link src 11.2.51.1 offload 11.3.51.0/24 dev swp1s1.51 proto kernel scope link src 11.3.51.1 offload 11.4.51.0/24 dev swp1s2.51 proto kernel scope link src 11.4.51.1 offload 11.5.51.0/24 dev swp1s3.51 proto kernel scope link src 11.5.51.1 offload 11.6.51.0/24 dev swp3s0.51 proto kernel scope link src 11.6.51.1 offload 11.7.51.0/24 dev swp3s1.51 proto kernel scope link src 11.7.51.1 offload 11.8.51.0/24 dev swp3s2.51 proto kernel scope link src 11.8.51.1 offload 11.9.51.0/24 dev swp3s3.51 proto kernel scope link src 11.9.51.1 offload$ devlink resource set pci/0000:03:00.0 path /kvd/hash_double size 0
On this command you are correct, 0 is not taken:
$ devlink resource set pci/0000:03:00.0 path /kvd/hash_double size 0
$ devlink resource show pci/0000:03:00.0
pci/0000:03:00.0:
name kvd size 245760 size_valid true
resources:
name linear size 0 occ 0
name hash_double size 60416
name hash_single size 87040but the 'set' command did not fail with a proper extack based error message, so consider this another a bug report.
Quoted 21 lines · David Ahern
Quoted 13 lines · Arkadi Sharshevsky
Quoted 13 lines
[1] This is allowed by the current patch set and perhaps it should not be:
$ ip ro ls vrf vrf1101 unreachable default metric 8192 11.2.51.0/24 dev swp1s0.51 proto kernel scope link src 11.2.51.1 offload 11.3.51.0/24 dev swp1s1.51 proto kernel scope link src 11.3.51.1 offload 11.4.51.0/24 dev swp1s2.51 proto kernel scope link src 11.4.51.1 offload 11.5.51.0/24 dev swp1s3.51 proto kernel scope link src 11.5.51.1 offload 11.6.51.0/24 dev swp3s0.51 proto kernel scope link src 11.6.51.1 offload 11.7.51.0/24 dev swp3s1.51 proto kernel scope link src 11.7.51.1 offload 11.8.51.0/24 dev swp3s2.51 proto kernel scope link src 11.8.51.1 offload 11.9.51.0/24 dev swp3s3.51 proto kernel scope link src 11.9.51.1 offloadQuoted 4 lines
Quoted 1 line
$ devlink resource set pci/0000:03:00.0 path /kvd/linear size 0This line actually did nothing, because size zero is not acceptable see patch 6. This is pure userpsace problem that error is not shown.
Then perhaps you have a kernel side bug. After the reload I get this:
Quoted 8 lines
$ devlink resource show pci/0000:03:00.0
pci/0000:03:00.0:
name kvd size 245760 size_valid true
resources:
name linear size 0 occ 0
name hash_double size 60416
name hash_single size 87040Actually no bug here, the linear can be zero. This implies no nexthop routes. The adj table uses it as you can see.
Quoted 52 lines
Quoted 5 lines
You can verify it by dumping the resources and see that there is no pending change (only size and not
size_new).Quoted 8 lines
Quoted 4 lines
$ devlink reload pci/0000:03:00.0 $ ip ro ls vrf vrf1101 unreachable default metric 8192So you just performed full reload of the driver which includes unregistration of all the netdevs and full init. KVD update requires full teardown of the driver.
you are right, I forgot to do a networking reload. Because of the above (0 was actually taken) all kinds of errors are spewed on 'ifreload -av' and there is no change to the ro ls:
$ ip ro ls vrf vrf1101 unreachable default metric 8192Quoted 20 lines
The system will not get back to the same state after reloading, It's should be done on init. But it doesn't have to be like this this, each driver provides his own reload devlink op implementation so in our case full blown reset is required.
Quoted 13 lines
[2] Same exact result for setting
hash_doubleto 0:$ ip ro ls vrf vrf1101 unreachable default metric 8192 11.2.51.0/24 dev swp1s0.51 proto kernel scope link src 11.2.51.1 offload 11.3.51.0/24 dev swp1s1.51 proto kernel scope link src 11.3.51.1 offload 11.4.51.0/24 dev swp1s2.51 proto kernel scope link src 11.4.51.1 offload 11.5.51.0/24 dev swp1s3.51 proto kernel scope link src 11.5.51.1 offload 11.6.51.0/24 dev swp3s0.51 proto kernel scope link src 11.6.51.1 offload 11.7.51.0/24 dev swp3s1.51 proto kernel scope link src 11.7.51.1 offload 11.8.51.0/24 dev swp3s2.51 proto kernel scope link src 11.8.51.1 offload 11.9.51.0/24 dev swp3s3.51 proto kernel scope link src 11.9.51.1 offload$ devlink resource set pci/0000:03:00.0 path /kvd/hash_double size 0On this command you are correct, 0 is not taken:
$ devlink resource set pci/0000:03:00.0 path /kvd/hash_double size 0 $ devlink resource show pci/0000:03:00.0 pci/0000:03:00.0: name kvd size 245760 size_valid true resources: name linear size 0 occ 0 name hash_double size 60416 name hash_single size 87040
Quoted 3 lines
but the 'set' command did not fail with a proper extack based error message, so consider this another a bug report.
Yeah, this is a bug, but a userspace one. I actually sniffed the nl messages with nlmon and saw the extended ack packet with the required string.
Quoted 103 lines · David Ahern
Quoted 34 lines · Jiri Pirko
Quoted 33 lines · Wed, Dec 27, 2017 at 05:05:09AM CET, [email protected] wrote:
Quoted 15 lines · Jiri Pirko
From: Jiri Pirko <[email protected]>
Many of the ASIC's internal resources are limited and are shared between several hardware procedures. For example, unified hash-based memory can be used for many lookup purposes, like FDB and LPM. In many cases the user can provide a partitioning scheme for such a resource in order to perform fine tuning for his application. In such cases performing driver reload is needed for the changes to take place, thus this patchset also adds support for hot reload.
Such an abstraction can be coupled with devlink's dpipe interface, which models the ASIC's pipeline as a graph of match/action tables. By modeling the hardware resource object, and by coupling it to several dpipe tables, further visibility can be achieved in order to debug ASIC-wide issues.
Quoted 4 lines
The proposed interface will provide the user the ability to understand the limitations of the hardware, and receive notification regarding its occupancy. Furthermore, monitoring the resource occupancy can be done in real-time and can be useful in many cases.
In the last RFC (not v1, but RFC) I asked for some kind of description for each resource, and you and Arkadi have pushed back. Let's walk through an example to see what I mean:
$ devlink resource show pci/0000:03:00.0 pci/0000:03:00.0: name kvd size 245760 size_valid true resources: name linear size 98304 occ 0 name hash_double size 60416 name hash_single size 87040Quoted 7 lines
Quoted 4 lines
So this 2700 has 3 resources that can be managed -- some table or resource or something named 'kvd' with linear,
hash_doubleandhash_singlesub-resources. What are these names referring too? The above output gives no description, and 'kvd' is not an industry term. Further,This are internal resources specific to the ASIC. Would you like some description to each or something like that?
devlink has some nice self-documenting capabilities. What's missing here is a description of what the resource is used for in standard terms -- ipv4 host routes, fdb, nexthops, rifs, etc. Even if the description is a short list versus an exhaustive list of everything it is used for. e.g., Why would a user decrease linear and increase
hash_singleor vice versa?Quoted 8 lines
Quoted 5 lines
what are these sizes that a user can control? The output contains no units, no description, nothing. In short, the above output provides random numbers associated with random names.
Units are now exposed from kernel, just this version of iproute2 patch does not display it.
please provide an iproute2 patch that does so the full context if this patch set can be reviewed from a user perspective.
Quoted 42 lines
Quoted 41 lines
I can see dpipe tables exported by this device:
$ devlink dpipe header show pci/0000:03:00.0pci/0000:03:00.0:
namemlxsw_meta
field:
nameerif_portbitwidth 32mapping_typeifindex namel3_forwardbitwidth 1
namel3_dropbitwidth 1
nameadj_indexbitwidth 32
nameadj_sizebitwidth 32
nameadj_hash_indexbitwidth 32name ipv6
field:
name destination ip bitwidth 128name ipv4
field:
name destination ip bitwidth 32name ethernet
field:
name destination mac bitwidth 48but none mention 'kvd' or 'linear' or 'hash" and none of the other various devlink options:
$ devlink Usage: devlink [ OPTIONS ] OBJECT { COMMAND | help } where OBJECT := { dev | port | sb | monitor | dpipe }seem to related to resources.
So how does a user know what they are controlling by this 'resource' option? Is the user expected to have a PRM or user guide on hand for the specific device model that is being configured?
Quoted 7 lines
Quoted 3 lines
The relation of specific dpipe table to specific resource is exposed by the kernel as well. Probably the iproute2 patch just does not display it.
please provide an iproute2 patch that does so the full context if this patch set can be reviewed from a user perspective.
As Yuval stated you are using the wrong command here. You are printing the headers not the tables. On each dpipe table you can see the resource it is using (the resource path aka host table uses /kvd/hash_single for example).
This is already working. Just try it.
Quoted 20 lines
Quoted 9 lines
Quoted 8 lines
Again, I have no objections to kvd, linear, hash, etc terms as they do relate to Mellanox products. But kvd/linear, for example, does correlate to industry standard concepts in some way. My request is that the resource listing guide the user in some way, stating what these resources mean.
Quoted 4 lines
So the showed relation to dpipe table would be enougn or you would still like to see some description? I don't like the description concept here as the relations to dpipe table should tell user exactly what he needs to know.
I believe it is useful to have a 1-line, short description that gives the user some memory jogger as to what the resource is used for. It does not have to be an exhaustive list, but the user should not have to do mental jumping jacks running a bunch of commands to understand the resources for vendor specific asics.
Quoted 127 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Many of the ASIC's internal resources are limited and are shared
between
Quoted 1 line
Quoted 1 line
Quoted 1 line
several hardware procedures. For example, unified hash-based memory
can
Quoted 1 line
Quoted 1 line
Quoted 1 line
be used for many lookup purposes, like FDB and LPM. In many cases the
user
Quoted 1 line
Quoted 1 line
Quoted 1 line
can provide a partitioning scheme for such a resource in order to
perform
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
fine tuning for his application. In such cases performing driver reload is needed for the changes to take place, thus this patchset also adds support for hot reload.
Such an abstraction can be coupled with devlink's dpipe interface, which models the ASIC's pipeline as a graph of match/action tables. By
modeling
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
the hardware resource object, and by coupling it to several dpipe tables, further visibility can be achieved in order to debug ASIC-wide issues.
The proposed interface will provide the user the ability to understand the limitations of the hardware, and receive notification regarding its
occupancy.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Furthermore, monitoring the resource occupancy can be done in real-
time and
Quoted 14 lines
Quoted 14 lines
Quoted 1 line
can be useful in many cases.
In the last RFC (not v1, but RFC) I asked for some kind of description for each resource, and you and Arkadi have pushed back. Let's walk through an example to see what I mean:
$ devlink resource show pci/0000:03:00.0 pci/0000:03:00.0: name kvd size 245760 size_valid true resources: name linear size 98304 occ 0 name hash_double size 60416 name hash_single size 87040Quoted 3 lines
Quoted 3 lines
So this 2700 has 3 resources that can be managed -- some table or resource or something named 'kvd' with linear,
hash_doubleandhash_singlesub-resources. What are these names referring too? Theabove
Quoted 4 lines
Quoted 1 line
output gives no description, and 'kvd' is not an industry term. Further,
This are internal resources specific to the ASIC. Would you like some description to each or something like that?
devlink has some nice self-documenting capabilities. What's missing here is a description of what the resource is used for in standard terms -- ipv4 host routes, fdb, nexthops, rifs, etc. Even if the description is a short list versus an exhaustive list of everything it is used for. e.g., Why would a user decrease linear and increase
hash_singleor vice versa?Quoted 8 lines
Quoted 5 lines
what are these sizes that a user can control? The output contains no units, no description, nothing. In short, the above output provides random numbers associated with random names.
Units are now exposed from kernel, just this version of iproute2 patch does not display it.
please provide an iproute2 patch that does so the full context if this patch set can be reviewed from a user perspective.
Quoted 38 lines
Quoted 38 lines
I can see dpipe tables exported by this device:
$ devlink dpipe header show pci/0000:03:00.0pci/0000:03:00.0:
namemlxsw_meta
field:
nameerif_portbitwidth 32mapping_typeifindex namel3_forwardbitwidth 1
namel3_dropbitwidth 1
nameadj_indexbitwidth 32
nameadj_sizebitwidth 32
nameadj_hash_indexbitwidth 32name ipv6
field:
name destination ip bitwidth 128name ipv4
field:
name destination ip bitwidth 32name ethernet
field:
name destination mac bitwidth 48but none mention 'kvd' or 'linear' or 'hash" and none of the other various devlink options:
$ devlink Usage: devlink [ OPTIONS ] OBJECT { COMMAND | help } where OBJECT := { dev | port | sb | monitor | dpipe }seem to related to resources.
Quoted 7 lines
Quoted 3 lines
So how does a user know what they are controlling by this 'resource' option? Is the user expected to have a PRM or user guide on hand for the specific device model that is being configured?
The relation of specific dpipe table to specific resource is exposed by the kernel as well. Probably the iproute2 patch just does not display it.
please provide an iproute2 patch that does so the full context if this patch set can be reviewed from a user perspective.
Quoted 9 lines
Quoted 8 lines
Again, I have no objections to kvd, linear, hash, etc terms as they do relate to Mellanox products. But kvd/linear, for example, does correlate to industry standard concepts in some way. My request is that the resource listing guide the user in some way, stating what these resources mean.
Quoted 4 lines
So the showed relation to dpipe table would be enougn or you would still like to see some description? I don't like the description concept here as the relations to dpipe table should tell user exactly what he needs to know.
Quoted 5 lines
I believe it is useful to have a 1-line, short description that gives the user some memory jogger as to what the resource is used for. It does not have to be an exhaustive list, but the user should not have to do mental jumping jacks running a bunch of commands to understand the resources for vendor specific asics.
Perhaps we can simply have devlink utility output the dpipe table[s] associated with the resource when showing the resource? It would contain live information as well as prevent the need for 'mental jumping jacks'.
Quoted 17 lines · Yuval Mintz
Quoted 11 lines
Quoted 10 lines
Quoted 5 lines
Again, I have no objections to kvd, linear, hash, etc terms as they do relate to Mellanox products. But kvd/linear, for example, does correlate to industry standard concepts in some way. My request is that the resource listing guide the user in some way, stating what these resources mean.
So the showed relation to dpipe table would be enougn or you would still like to see some description? I don't like the description concept here as the relations to dpipe table should tell user exactly what he needs to know.
Quoted 5 lines
I believe it is useful to have a 1-line, short description that gives the user some memory jogger as to what the resource is used for. It does not have to be an exhaustive list, but the user should not have to do mental jumping jacks running a bunch of commands to understand the resources for vendor specific asics.
Quoted 5 lines
Perhaps we can simply have devlink utility output the dpipe table[s] associated with the resource when showing the resource? It would contain live information as well as prevent the need for 'mental jumping jacks'.
My primary contention for this static partitioning is that the proposal is not giving the user the information they need to make decisions.
As I mentioned earlier, the resource show command gives this:
$ devlink resource show pci/0000:03:00.0
pci/0000:03:00.0:
name kvd size 245760 size_valid true
resources:
name linear size 98304 occ 0
name hash_double size 60416
name hash_single size 87040the paths /kvd/linear, /kvd/hash_single and /kvd/hash_double are essentially random names (nothing related to industry standard names) and the listed sizes are random numbers (no units)[1]. There is nothing there to tell a user what they can adjust or why they would want to make an adjustment.
Looking at 'dpipe table show':
$ devlink dpipe table show pci/0000:03:00.0
pci/0000:03:00.0:
name mlxsw_erif size 1000 counters_enabled false
match:
type field_exact header mlxsw_meta field erif_port mapping ifindex
action:
type field_modify header mlxsw_meta field l3_forward
type field_modify header mlxsw_meta field l3_drop resource_path /kvd/hash_single name mlxsw_host4 size 62counters_enabled false
match:
type field_exact header mlxsw_meta field erif_port mapping ifindex type field_exact header ipv4 field destination ip
action:
type field_modify header ethernet field destination mac
resource_path /kvd/hash_double name mlxsw_host6 size 0counters_enabled false
match:
type field_exact header mlxsw_meta field erif_port mapping ifindex type field_exact header ipv6 field destination ip
action:
type field_modify header ethernet field destination mac
resource_path /kvd/linear name mlxsw_adj size 0 counters_enabled false match:
type field_exact header mlxsw_meta field adj_index
type field_exact header mlxsw_meta field adj_size
type field_exact header mlxsw_meta field adj_hash_index
action:
type field_modify header ethernet field destination mac type field_modify header mlxsw_meta field erif_port mapping ifindex
So there are 4 tables exported to userspace:
1. mlxsw_erif table which is not in any of the kvd regions (no resource path is given) and it has a size of 1000. Does mlxsw_erif mean a rif as in Router Interfaces? So the switch supports up to 1000 router interfaces.
2. mlxsw_host4 in /kvd/hash_single with a size of 62. Based on the fields mlxsw_host4 means IPv4 host entries (neighbor entries). Why is the size set at 62? Seems really low.
3. mlxsw_host6 in /kvd/hash_double with a size of 0. Based on the fields mlxsw_host6 means IPv6 host entries (neighbor entries). The size of 0 is concerning. I guess the switch is not configured to do IPv6?
4. mlxsw_adj in /kvd/linear with a size of 0. Based on the fields I am going to guess it is an fdb entry????
So if I combine the output of "resource show" and "dpipe table show", I can conclude:
1. /kvd/linear is only used for fdb entries. So if I want an L3 only use case I can set /kvd/linear 0. Is that correct? I believe the answer is no, but based on the information given it seems that way.
2. /kvd/hash_double has a size of 60416, but it is only used for mlxsw_host6 table which has a size of 0. Now, I am confused.
3. /kvd/hash_single has a size of 87040, but it is only used for mlxsw_host4 table which has a size of 62. Again confused.
What is a user to make of this output? How is it useful for making decisions on whether to increase or decrease some resource?
----
[1] In a response, Jiri mentioned units are added by this patch set but all I see in the patches is this:
@@ -245,4 +256,8 @@ enum devlink_dpipe_header_id {
DEVLINK_DPIPE_HEADER_IPV6,
};
+enum devlink_resource_unit {
+ DEVLINK_RESOURCE_UNIT_DOUBLE_WORD,
+};
+
#endif /* _UAPI_LINUX_DEVLINK_H_ */
DEVLINK_RESOURCE_UNIT_DOUBLE_WORD means what???
Jiri Pirko
maintainerQuoted 36 lines · Thu, Dec 28, 2017 at 05:09:09PM CET, [email protected] wrote:
Quoted 17 lines · Yuval Mintz
Quoted 11 lines
Quoted 10 lines
Quoted 5 lines
Again, I have no objections to kvd, linear, hash, etc terms as they do relate to Mellanox products. But kvd/linear, for example, does correlate to industry standard concepts in some way. My request is that the resource listing guide the user in some way, stating what these resources mean.
So the showed relation to dpipe table would be enougn or you would still like to see some description? I don't like the description concept here as the relations to dpipe table should tell user exactly what he needs to know.
Quoted 5 lines
I believe it is useful to have a 1-line, short description that gives the user some memory jogger as to what the resource is used for. It does not have to be an exhaustive list, but the user should not have to do mental jumping jacks running a bunch of commands to understand the resources for vendor specific asics.
Quoted 5 lines
Perhaps we can simply have devlink utility output the dpipe table[s] associated with the resource when showing the resource? It would contain live information as well as prevent the need for 'mental jumping jacks'.
My primary contention for this static partitioning is that the proposal is not giving the user the information they need to make decisions.
As I mentioned earlier, the resource show command gives this:
$ devlink resource show pci/0000:03:00.0 pci/0000:03:00.0: name kvd size 245760 size_valid true resources: name linear size 98304 occ 0 name hash_double size 60416 name hash_single size 87040
Quoted 2 lines
the paths /kvd/linear, /kvd/hash_single and /kvd/hash_double are essentially random names (nothing related to industry standard names)
Of course. There is no industry standard for internal ASIC implementations. This is the same as for dpipe. There is no industry standard for ASIC pipeline. dpipe visualizes it. This resource patch visualizes the internal ASIC resources and their mapping to the individual dpipe tables.
Quoted 42 lines
and the listed sizes are random numbers (no units)[1]. There is nothing there to tell a user what they can adjust or why they would want to make an adjustment.
Looking at 'dpipe table show':
$ devlink dpipe table show pci/0000:03:00.0 pci/0000:03:00.0: name mlxsw_erif size 1000 counters_enabled false match: type field_exact header mlxsw_meta field erif_port mapping ifindex action: type field_modify header mlxsw_meta field l3_forward type field_modify header mlxsw_meta field l3_drop
resource_path/kvd/hash_single namemlxsw_host4size 62counters_enabledfalse
match:
typefield_exactheadermlxsw_metafielderif_portmapping ifindex typefield_exactheader ipv4 field destination ip
action:
typefield_modifyheader ethernet field destination mac
resource_path/kvd/hash_double namemlxsw_host6size 0counters_enabledfalse
match:
typefield_exactheadermlxsw_metafielderif_portmapping ifindex typefield_exactheader ipv6 field destination ip
action:
typefield_modifyheader ethernet field destination mac
resource_path/kvd/linear namemlxsw_adjsize 0counters_enabledfalse match:
typefield_exactheadermlxsw_metafieldadj_index
typefield_exactheadermlxsw_metafieldadj_size
typefield_exactheadermlxsw_metafieldadj_hash_index
action:
typefield_modifyheader ethernet field destination mac typefield_modifyheadermlxsw_metafielderif_portmapping ifindex
Quoted 7 lines
So there are 4 tables exported to userspace:
1.
mlxsw_eriftable which is not in any of the kvd regions (no resource path is given) and it has a size of 1000. Doesmlxsw_erifmean a rif as in Router Interfaces? So the switch supports up to 1000 router interfaces.2.
mlxsw_host4in /kvd/hash_single with a size of 62. Based on the
Size tells you the actual size. It cannot give you max size. The reason is simple. The resources are shared among multiple tables. That is exactly what this resource patch makes visible.
Quoted 9 lines
fields
mlxsw_host4means IPv4 host entries (neighbor entries). Why is the size set at 62? Seems really low.3.
mlxsw_host6in /kvd/hash_double with a size of 0. Based on the fieldsmlxsw_host6means IPv6 host entries (neighbor entries). The size of 0 is concerning. I guess the switch is not configured to do IPv6?4.
mlxsw_adjin /kvd/linear with a size of 0. Based on the fields I am going to guess it is an fdb entry????
Quoted 12 lines · Jiri Pirko
Quoted 7 lines
So there are 4 tables exported to userspace:
1.
mlxsw_eriftable which is not in any of the kvd regions (no resource path is given) and it has a size of 1000. Doesmlxsw_erifmean a rif as in Router Interfaces? So the switch supports up to 1000 router interfaces.2.
mlxsw_host4in /kvd/hash_single with a size of 62. Based on theSize tells you the actual size. It cannot give you max size. The reason is simple. The resources are shared among multiple tables. That is exactly what this resource patch makes visible.
In the erif table, the 1000 is the max not current usage. I do not have 1000 interfaces:
$ ip -br li sh | wc -l 597
$ devlink dpipe table dump pci/0000:03:00.0 name mlxsw_erif
...
index 503
match_value:
type field_exact header mlxsw_meta field erif_port mapping ifindex
mapping_value 601 value 503
action_value:
type field_modify header mlxsw_meta field l3_forward value 1The host4 table it is current size with no maximum.
The meaning of table size needs to be consistent across tables.
Jiri Pirko
maintainerQuoted 7 lines · Thu, Dec 28, 2017 at 05:33:58PM CET, [email protected] wrote:
Quoted 6 lines · Jiri Pirko
Quoted 6 lines
So there are 4 tables exported to userspace:
1.
mlxsw_eriftable which is not in any of the kvd regions (no resource path is given) and it has a size of 1000. Doesmlxsw_erifmean a rif as in Router Interfaces? So the switch supports up to 1000 router interfaces.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
2.
mlxsw_host4in /kvd/hash_single with a size of 62. Based on theSize tells you the actual size. It cannot give you max size. The reason is simple. The resources are shared among multiple tables. That is exactly what this resource patch makes visible.
In the erif table, the 1000 is the max not current usage. I do not have
I believe that is a bug in erif dpipe implementation (mlxsw_sp_dpipe_table_erif_size_get) We'll fix that. Thanks!
Quoted 19 lines
1000 interfaces:
$ ip -br li sh | wc -l 597$ devlink dpipe table dump pci/0000:03:00.0 name mlxsw_erif ... index 503 match_value: type field_exact header mlxsw_meta field erif_port mapping ifindex mapping_value 601 value 503 action_value: type field_modify header mlxsw_meta field l3_forward value 1The host4 table it is current size with no maximum.
The meaning of table size needs to be consistent across tables.
Quoted 28 lines · David Ahern
Quoted 7 lines · Jiri Pirko
Quoted 7 lines
So there are 4 tables exported to userspace:
1.
mlxsw_eriftable which is not in any of the kvd regions (no resource path is given) and it has a size of 1000. Doesmlxsw_erifmean a rif as in Router Interfaces? So the switch supports up to 1000 router interfaces.Quoted 7 lines
Quoted 2 lines
2.
mlxsw_host4in /kvd/hash_single with a size of 62. Based on theSize tells you the actual size. It cannot give you max size. The reason is simple. The resources are shared among multiple tables. That is exactly what this resource patch makes visible.
In the erif table, the 1000 is the max not current usage. I do not have 1000 interfaces:
$ ip -br li sh | wc -l 597$ devlink dpipe table dump pci/0000:03:00.0 name mlxsw_erif ... index 503 match_value: type field_exact header mlxsw_meta field erif_port mapping ifindex mapping_value 601 value 503 action_value: type field_modify header mlxsw_meta field l3_forward value 1
Quoted 4 lines
The host4 table it is current size with no maximum.
The meaning of table size needs to be consistent across tables.
You are right the egress RIF table size is not correct, I will definitely fix it, but it is not what you think it should be. So in order to clarify this point, just a reminder:
1. Both dpipe and devlink resource are abstraction models for hardware entities, and as a result they true to provide generic objects. Each driver/ASIC should register his own and it absolutely proprietary implementation. There is absolutely NO industry standard here, the only thing that resembles a standard is that dpipe looks a bit like P4 only because its proved to be useful for describing packet forwarding pipelines. The host4 table is just a hardware process in the mellanox spectrum ASIC pipeline and it should not be part of ABI, sorry I clearly don't understand how this even came up.
2. Dpipe table is a single hardware process, most of the time it uses some resources (for example LPM algorithm uses hash memory).
3. ERIF table is a table that is located in the end of the L3 pipeline. The current dpipe description is not complete and that why it caused confusion. The table performs match on rif index and packet type (UC/MC/BC) and performs forward/drop decision. As you can see, for each rif the table can have several entries, which provide different statistics for different traffic types per rif, currently only the UC is exposed with forward.
4. ASICs use shared resource for many processes, this is exactly the behavior we want to expose!
Again, the size of the ERIF table should NOT provide the number of rifs which are in use, simply because dpipe tables do not describe hardware resources.
In the future the RIF bank will be exported as resource object with size of 1000, and in order to observe how much are in use you should check its occupancy. This is the whole reason of this interface.
Quoted 9 lines
1. Both dpipe and devlink resource are abstraction models for hardware entities, and as a result they true to provide generic objects. Each driver/ASIC should register his own and it absolutely proprietary implementation. There is absolutely NO industry standard here, the only thing that resembles a standard is that dpipe looks a bit like P4 only because its proved to be useful for describing packet forwarding pipelines. The host4 table is just a hardware process in the mellanox spectrum ASIC pipeline and it should not be part of ABI, sorry I clearly don't understand how this even came up.
Why should it not be part of the ABI? Are you saying it will change from version to version? Are you trying to warning people not to write scripts using it, because its meaning will change and what works now will break in the next kernel version?
Andrew
Jiri Pirko
maintainerQuoted 10 lines · Sat, Dec 30, 2017 at 11:18:50AM CET, [email protected] wrote:
Quoted 9 lines
1. Both dpipe and devlink resource are abstraction models for hardware entities, and as a result they true to provide generic objects. Each driver/ASIC should register his own and it absolutely proprietary implementation. There is absolutely NO industry standard here, the only thing that resembles a standard is that dpipe looks a bit like P4 only because its proved to be useful for describing packet forwarding pipelines. The host4 table is just a hardware process in the mellanox spectrum ASIC pipeline and it should not be part of ABI, sorry I clearly don't understand how this even came up.
Quoted 4 lines
Why should it not be part of the ABI? Are you saying it will change from version to version? Are you trying to warning people not to write scripts using it, because its meaning will change and what works now will break in the next kernel version?
In my opinion it should not change. Unless there is a bug (like the one DaveA found in mlxsw erif table). Existing tables and resources should be only added. It is the driver's maintainer responsibility to not to break user scripts.
Quoted 4 lines
In my opinion it should not change. Unless there is a bug (like the one DaveA found in mlxsw erif table). Existing tables and resources should be only added. It is the driver's maintainer responsibility to not to break user scripts.
So we agree with is ABI. Great.
Andrew
Quoted 23 lines · Jiri Pirko
From: Jiri Pirko <[email protected]>
Many of the ASIC's internal resources are limited and are shared between several hardware procedures. For example, unified hash-based memory can be used for many lookup purposes, like FDB and LPM. In many cases the user can provide a partitioning scheme for such a resource in order to perform fine tuning for his application. In such cases performing driver reload is needed for the changes to take place, thus this patchset also adds support for hot reload.
Such an abstraction can be coupled with devlink's dpipe interface, which models the ASIC's pipeline as a graph of match/action tables. By modeling the hardware resource object, and by coupling it to several dpipe tables, further visibility can be achieved in order to debug ASIC-wide issues.
The proposed interface will provide the user the ability to understand the
limitations of the hardware, and receive notification regarding its occupancy.
Furthermore, monitoring the resource occupancy can be done in real-time and
can be useful in many cases.
---
Userspace part prototype can be found at https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Farkadis%2Fiproute2%2F&data=02%7C01%7Carkadis%40mellanox.com%7C1ae3d8b4854a454e21e008d54c5329e3%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C636498842440762657&sdata=7MC2BFQFxjnmHqy2sOOL9VEa4ZGq6e5Z2n2WvuNgyFk%3D&reserved=0
atresource_devbranch.
Quoted 4 lines
v1->v2
- Add resource size attribute.
- Fix split bug.
Just to summarize the current fixes required:
1. ERIF dpipe table size is reporting wrong size. More precisely the ERIF table does not take rifs, so it should not be linked to the rif bank resource (is not part of this patchset, future extension).
2. Extended ACK user-space bug.
3. ABI documentation- Not sure we agreed upon it, Jiri?
If I missed something please respond. Nothing of the fixes mentioned above is relevant for this patchset actually.
Couple of key-points:
1. Constrains\trade off about setting the sizes - this can be obtained trivially from the resource tree nested structure.
2. Dpipe provides the mapping of hardware processes to resources.
3. Units - each resource specifies his units, if dpipe table's size is X and its related to some resource its size is normalized to that resources basic unit.
IMO this is the most hardware exact interaction, and this is the way it should be exported from the kernel, if something is not presented in 'user' convenient way some utilities can be implemented in userspace to easily do it. Furthermore, some examples will be provided for the whole kvd tree partition for different cases (IPv6 heavy etc..). Advanced user will be able to tweak it as they like.
Regarding the 'switchdev' layer I think that kernel's software tables like nexthops/neigh/routes should be mapped to dpipe tables and not to resources directly:
kernel_fdb--> dpipe_fdb -->/kvd/hash_single.
Quoted 25 lines
Arkadi Sharshevsky (10):
devlink: Add per devlink instance lock
devlink: Add support for resource abstraction
devlink: Add support for reload
devlink: Add relation between dpipe and resource
mlxsw: pci: Add support for performing bus reset
mlxsw: spectrum: Register KVD resources with devlink
mlxsw:spectrum_dpipe: Connect dpipe tables to resources
mlxsw: spectrum: Add support for getting kvdl occupancy
mlxsw: pci: Add support for getting resource through devlink
mlxsw: core: Add support for reloaddrivers/net/ethernet/mellanox/mlxsw/core.c | 85 ++- drivers/net/ethernet/mellanox/mlxsw/core.h | 16 +- drivers/net/ethernet/mellanox/mlxsw/i2c.c | 5 +- drivers/net/ethernet/mellanox/mlxsw/pci.c | 98 ++-- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 205 ++++++++ drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 13 + .../net/ethernet/mellanox/mlxsw/spectrum_dpipe.c | 72 ++- .../net/ethernet/mellanox/mlxsw/spectrum_kvdl.c | 26 + include/net/devlink.h | 97 ++++ include/uapi/linux/devlink.h | 21 + net/core/devlink.c | 573 ++++++++++++++++++--- 11 files changed, 1079 insertions(+), 132 deletions(-)
Jiri Pirko
maintainerQuoted 31 lines · Mon, Jan 01, 2018 at 03:58:33PM CET, [email protected] wrote:
Quoted 23 lines · Jiri Pirko
From: Jiri Pirko <[email protected]>
Many of the ASIC's internal resources are limited and are shared between several hardware procedures. For example, unified hash-based memory can be used for many lookup purposes, like FDB and LPM. In many cases the user can provide a partitioning scheme for such a resource in order to perform fine tuning for his application. In such cases performing driver reload is needed for the changes to take place, thus this patchset also adds support for hot reload.
Such an abstraction can be coupled with devlink's dpipe interface, which models the ASIC's pipeline as a graph of match/action tables. By modeling the hardware resource object, and by coupling it to several dpipe tables, further visibility can be achieved in order to debug ASIC-wide issues.
The proposed interface will provide the user the ability to understand the
limitations of the hardware, and receive notification regarding its occupancy.
Furthermore, monitoring the resource occupancy can be done in real-time and
can be useful in many cases.
---
Userspace part prototype can be found at https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Farkadis%2Fiproute2%2F&data=02%7C01%7Carkadis%40mellanox.com%7C1ae3d8b4854a454e21e008d54c5329e3%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C636498842440762657&sdata=7MC2BFQFxjnmHqy2sOOL9VEa4ZGq6e5Z2n2WvuNgyFk%3D&reserved=0
atresource_devbranch.Quoted 4 lines
v1->v2
- Add resource size attribute.
- Fix split bug.
Quoted 7 lines
Just to summarize the current fixes required:
1. ERIF dpipe table size is reporting wrong size. More precisely the ERIF table does not take rifs, so it should not be linked to the rif bank resource (is not part of this patchset, future extension).
2. Extended ACK user-space bug.
3. ABI documentation- Not sure we agreed upon it, Jiri?
Question is where to put it. It is mlxsw-specific thing, moreover, Spectrum-specific thing, same as dpipe tables etc. Not sure. Perhaps Documentation/networking/mlxsw.txt ?
Quoted 20 lines
If I missed something please respond. Nothing of the fixes mentioned above is relevant for this patchset actually.
Couple of key-points:
1. Constrains\trade off about setting the sizes - this can be obtained trivially from the resource tree nested structure.
2. Dpipe provides the mapping of hardware processes to resources.
3. Units - each resource specifies his units, if dpipe table's size is X and its related to some resource its size is normalized to that resources basic unit.IMO this is the most hardware exact interaction, and this is the way it should be exported from the kernel, if something is not presented in 'user' convenient way some utilities can be implemented in userspace to easily do it. Furthermore, some examples will be provided for the whole kvd tree partition for different cases (IPv6 heavy etc..). Advanced user will be able to tweak it as they like.
Quoted 3 lines
Regarding the 'switchdev' layer I think that kernel's software tables like nexthops/neigh/routes should be mapped to dpipe tables and not to resources directly:
Sure. dpipe table -> resource mapping is the only one that makes sense.
Quoted 28 lines
kernel_fdb-->
dpipe_fdb-->/kvd/hash_single.Quoted 25 lines
Arkadi Sharshevsky (10):
devlink: Add per devlink instance lock
devlink: Add support for resource abstraction
devlink: Add support for reload
devlink: Add relation between dpipe and resource
mlxsw: pci: Add support for performing bus reset
mlxsw: spectrum: Register KVD resources with devlink
mlxsw:spectrum_dpipe: Connect dpipe tables to resources
mlxsw: spectrum: Add support for getting kvdl occupancy
mlxsw: pci: Add support for getting resource through devlink
mlxsw: core: Add support for reloaddrivers/net/ethernet/mellanox/mlxsw/core.c | 85 ++- drivers/net/ethernet/mellanox/mlxsw/core.h | 16 +- drivers/net/ethernet/mellanox/mlxsw/i2c.c | 5 +- drivers/net/ethernet/mellanox/mlxsw/pci.c | 98 ++-- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 205 ++++++++ drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 13 + .../net/ethernet/mellanox/mlxsw/spectrum_dpipe.c | 72 ++- .../net/ethernet/mellanox/mlxsw/spectrum_kvdl.c | 26 + include/net/devlink.h | 97 ++++ include/uapi/linux/devlink.h | 21 + net/core/devlink.c | 573 ++++++++++++++++++--- 11 files changed, 1079 insertions(+), 132 deletions(-)
Quoted 3 lines
Question is where to put it. It is mlxsw-specific thing, moreover, Spectrum-specific thing, same as dpipe tables etc. Not sure. Perhaps
Documentation/networking/mlxsw.txt?
Hi Jiri
Documentation/ABI seems like the correct place. There is nothing in the README which says it is limited to files. You could use an name like devlink-driver-mlxsw.
Andrew
Jiri Pirko
maintainerQuoted 9 lines · Tue, Jan 02, 2018 at 02:41:13PM CET, [email protected] wrote:
Quoted 3 lines
Question is where to put it. It is mlxsw-specific thing, moreover, Spectrum-specific thing, same as dpipe tables etc. Not sure. Perhaps
Documentation/networking/mlxsw.txt?Hi Jiri
Documentation/ABIseems like the correct place. There is nothing in the README which says it is limited to files. You could use an name like devlink-driver-mlxsw.
Okay. Sounds sane. Thanks.
Quoted 12 lines · Arkadi Sharshevsky
Just to summarize the current fixes required:
1. ERIF dpipe table size is reporting wrong size. More precisely the ERIF table does not take rifs, so it should not be linked to the rif bank resource (is not part of this patchset, future extension).
2. Extended ACK user-space bug.
3. ABI documentation- Not sure we agreed upon it, Jiri?If I missed something please respond. Nothing of the fixes mentioned above is relevant for this patchset actually.
Can you fix the userspace command and then we come back to what else is needed? Right now, it is hard to tell what is a user space bug and what is a kernel space bug.
For example:
$ devlink resource set pci/0000:03:00.0 path /kvd/linear size 10000
$ devlink resource show pci/0000:03:00.0
pci/0000:03:00.0:
name kvd size 245760 size_valid true
resources:
name linear size 98304 occ 0
name hash_double size 60416
name hash_single size 87040The set command did not fail, yet there is no size_new arg in the output like there is for this change:
$ devlink resource set pci/0000:03:00.0 path /kvd/linear size 0
$ devlink resource show pci/0000:03:00.0
pci/0000:03:00.0:
name kvd size 245760 size_valid true
resources:
name linear size 98304 size_new 0 occ 0
name hash_double size 60416
name hash_single size 87040Quoted 31 lines · David Ahern
Quoted 12 lines · Arkadi Sharshevsky
Just to summarize the current fixes required:
1. ERIF dpipe table size is reporting wrong size. More precisely the ERIF table does not take rifs, so it should not be linked to the rif bank resource (is not part of this patchset, future extension).
2. Extended ACK user-space bug.
3. ABI documentation- Not sure we agreed upon it, Jiri?If I missed something please respond. Nothing of the fixes mentioned above is relevant for this patchset actually.
Can you fix the userspace command and then we come back to what else is needed? Right now, it is hard to tell what is a user space bug and what is a kernel space bug.
For example:
$ devlink resource set pci/0000:03:00.0 path /kvd/linear size 10000 $ devlink resource show pci/0000:03:00.0 pci/0000:03:00.0: name kvd size 245760 size_valid true resources: name linear size 98304 occ 0 name hash_double size 60416 name hash_single size 87040The set command did not fail, yet there is no
size_newarg in the output like there is for this change:
Quoted 9 lines
$ devlink resource set pci/0000:03:00.0 path /kvd/linear size 0
$ devlink resource show pci/0000:03:00.0
pci/0000:03:00.0:
name kvd size 245760 size_valid true
resources:
name linear size 98304 size_new 0 occ 0
name hash_double size 60416
name hash_single size 87040As I stated this is a user-space bug which I fixed, and updated my repo so please pull. Devlink uses mnl,and currently mnl does not support extended ack. I added support for this in my local ver of libmnl:
https://github.com/arkadis/libmnl.git
On branch master, so you can check it out. Besides this bugs, which were userspace, can please specify what are the pending problems from your point of view? Thanks!
Quoted 9 lines · Arkadi Sharshevsky
As I stated this is a user-space bug which I fixed, and updated my repo so please pull. Devlink uses mnl,and currently mnl does not support extended ack. I added support for this in my local ver of libmnl:
https://github.com/arkadis/libmnl.git
On branch master, so you can check it out. Besides this bugs, which were userspace, can please specify what are the pending problems from your point of view? Thanks!
devlink is in iproute2 package and it has extack support. See 'git log lib/libnetlink.c'
You do not need to modify libmnl to get extack output in devlink. Can you update the command accordingly? Once it works I will come back to this topic and take another look.
Jiri Pirko
maintainerQuoted 5 lines · Wed, Jan 03, 2018 at 07:14:16PM CET, [email protected] wrote:
Quoted 4 lines · Arkadi Sharshevsky
As I stated this is a user-space bug which I fixed, and updated my repo so please pull. Devlink uses mnl,and currently mnl does not support extended ack. I added support for this in my local ver of libmnl:
Quoted 8 lines
Quoted 5 lines
https://github.com/arkadis/libmnl.git
On branch master, so you can check it out. Besides this bugs, which were userspace, can please specify what are the pending problems from your point of view? Thanks!
devlink is in iproute2 package and it has extack support. See 'git log
lib/libnetlink.c'
Dave, devlink uses libmnl.
Quoted 8 lines · Jiri Pirko
Quoted 7 lines · Wed, Jan 03, 2018 at 07:14:16PM CET, [email protected] wrote:
Quoted 6 lines · Arkadi Sharshevsky
As I stated this is a user-space bug which I fixed, and updated my repo so please pull. Devlink uses mnl,and currently mnl does not support extended ack. I added support for this in my local ver of libmnl:
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
On branch master, so you can check it out. Besides this bugs, which were userspace, can please specify what are the pending problems from your point of view? Thanks!
devlink is in iproute2 package and it has extack support. See 'git log
lib/libnetlink.c'Dave, devlink uses libmnl.
Now I remember. You wrote it independently and but needed iproute2 be a delivery vehicle. It uses none of the common infrastructure from iproute2. Could we make this more difficult ....
Sometime in the next day I will jump through the hoops to get a proper devlink command.
Jiri Pirko
maintainerQuoted 16 lines · Wed, Jan 03, 2018 at 07:29:46PM CET, [email protected] wrote:
Quoted 15 lines · Jiri Pirko
Quoted 13 lines · Wed, Jan 03, 2018 at 07:14:16PM CET, [email protected] wrote:
Quoted 9 lines · Arkadi Sharshevsky
As I stated this is a user-space bug which I fixed, and updated my repo so please pull. Devlink uses mnl,and currently mnl does not support extended ack. I added support for this in my local ver of libmnl:
https://github.com/arkadis/libmnl.git
On branch master, so you can check it out. Besides this bugs, which were userspace, can please specify what are the pending problems from your point of view? Thanks!
devlink is in iproute2 package and it has extack support. See 'git log
lib/libnetlink.c'
Quoted 6 lines
Quoted 2 lines
Dave, devlink uses libmnl.
Now I remember. You wrote it independently and but needed iproute2 be a delivery vehicle. It uses none of the common infrastructure from iproute2. Could we make this more difficult ....
Feel free to rewrite it to use lib/libnetlink.c. Should not be that hard. Note that at the time I was pushing devlink userspace, tipc also used libmnl as a part of iproute2, so devlink was not the first one. That is why I decided not to rewrite.
As of the rest of the "common infrastructure", what exactly do you have in mind?
Quoted 3 lines
Sometime in the next day I will jump through the hoops to get a proper devlink command.
Quoted 24 lines · Jiri Pirko
Quoted 16 lines · Wed, Jan 03, 2018 at 07:29:46PM CET, [email protected] wrote:
Quoted 15 lines · Jiri Pirko
Quoted 13 lines · Wed, Jan 03, 2018 at 07:14:16PM CET, [email protected] wrote:
Quoted 9 lines · Arkadi Sharshevsky
As I stated this is a user-space bug which I fixed, and updated my repo so please pull. Devlink uses mnl,and currently mnl does not support extended ack. I added support for this in my local ver of libmnl:
https://github.com/arkadis/libmnl.git
On branch master, so you can check it out. Besides this bugs, which were userspace, can please specify what are the pending problems from your point of view? Thanks!
devlink is in iproute2 package and it has extack support. See 'git log
lib/libnetlink.c'Quoted 6 lines
Quoted 2 lines
Dave, devlink uses libmnl.
Now I remember. You wrote it independently and but needed iproute2 be a delivery vehicle. It uses none of the common infrastructure from iproute2. Could we make this more difficult ....
Quoted 8 lines
Feel free to rewrite it to use
lib/libnetlink.c. Should not be that hard. Note that at the time I was pushing devlink userspace, tipc also used libmnl as a part of iproute2, so devlink was not the first one. That is why I decided not to rewrite.As of the rest of the "common infrastructure", what exactly do you have in mind?
This is what I am getting at. Apparently, these resource patches for devlink require a patched libmnl to work properly. It is wrong for iproute2 to accept this patch and to build a devlink command that we know does not work. That means iproute2 needs a dependency on a specific version of libmnl - a version which does not yet exist because those changes have not been accepted and libmnl version released. Adding that dependency is going to inconvenience to all current users of the iproute2 repo.
David Miller
maintainerFrom: David Ahern <[email protected]>
Date: Thu, 4 Jan 2018 09:58:51 -0700
Quoted 8 lines
This is what I am getting at. Apparently, these resource patches for devlink require a patched libmnl to work properly. It is wrong for iproute2 to accept this patch and to build a devlink command that we know does not work. That means iproute2 needs a dependency on a specific version of libmnl - a version which does not yet exist because those changes have not been accepted and libmnl version released. Adding that dependency is going to inconvenience to all current users of the iproute2 repo.
+1
Jiri Pirko
maintainerQuoted 30 lines · Thu, Jan 04, 2018 at 05:58:51PM CET, [email protected] wrote:
Quoted 29 lines · Jiri Pirko
Quoted 16 lines · Wed, Jan 03, 2018 at 07:29:46PM CET, [email protected] wrote:
Quoted 15 lines · Jiri Pirko
Quoted 13 lines · Wed, Jan 03, 2018 at 07:14:16PM CET, [email protected] wrote:
Quoted 9 lines · Arkadi Sharshevsky
As I stated this is a user-space bug which I fixed, and updated my repo so please pull. Devlink uses mnl,and currently mnl does not support extended ack. I added support for this in my local ver of libmnl:
https://github.com/arkadis/libmnl.git
On branch master, so you can check it out. Besides this bugs, which were userspace, can please specify what are the pending problems from your point of view? Thanks!
devlink is in iproute2 package and it has extack support. See 'git log
lib/libnetlink.c'Quoted 6 lines
Quoted 2 lines
Dave, devlink uses libmnl.
Now I remember. You wrote it independently and but needed iproute2 be a delivery vehicle. It uses none of the common infrastructure from iproute2. Could we make this more difficult ....
Feel free to rewrite it to use
lib/libnetlink.c. Should not be that hard. Note that at the time I was pushing devlink userspace, tipc also used libmnl as a part of iproute2, so devlink was not the first one. That is why I decided not to rewrite.
Quoted 6 lines
Quoted 3 lines
As of the rest of the "common infrastructure", what exactly do you have in mind?
This is what I am getting at. Apparently, these resource patches for devlink require a patched libmnl to work properly. It is wrong for
What do you mean, "work properly". If there is no patched libmnl, only thing what happens is that the extack won't be processed and shown. That is the same behaviour as if you compile iproute2 package without libmnl - all works, used just don't see extack messages.
I don't see any problem in that. Do you?
Quoted 6 lines
iproute2 to accept this patch and to build a devlink command that we know does not work. That means iproute2 needs a dependency on a specific version of libmnl - a version which does not yet exist because those changes have not been accepted and libmnl version released. Adding that dependency is going to inconvenience to all current users of the iproute2 repo.
Quoted 16 lines · Jiri Pirko
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
Now I remember. You wrote it independently and but needed iproute2 be a delivery vehicle. It uses none of the common infrastructure from iproute2. Could we make this more difficult ....
Feel free to rewrite it to use
lib/libnetlink.c. Should not be that hard. Note that at the time I was pushing devlink userspace, tipc also used libmnl as a part of iproute2, so devlink was not the first one. That is why I decided not to rewrite.Quoted 6 lines
Quoted 3 lines
As of the rest of the "common infrastructure", what exactly do you have in mind?
This is what I am getting at. Apparently, these resource patches for devlink require a patched libmnl to work properly. It is wrong for
Quoted 6 lines
What do you mean, "work properly". If there is no patched libmnl, only thing what happens is that the extack won't be processed and shown. That is the same behaviour as if you compile iproute2 package without libmnl - all works, used just don't see extack messages.
I don't see any problem in that. Do you?
I have libmnl installed. I build iproute2. I don't get extended ack messages on devlink failures. That is a problem. That is building a command that is known not to work as it should given the build dependencies.
Jiri Pirko
maintainerQuoted 22 lines · Thu, Jan 25, 2018 at 04:38:41PM CET, [email protected] wrote:
Quoted 21 lines · Jiri Pirko
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
Now I remember. You wrote it independently and but needed iproute2 be a delivery vehicle. It uses none of the common infrastructure from iproute2. Could we make this more difficult ....
Feel free to rewrite it to use
lib/libnetlink.c. Should not be that hard. Note that at the time I was pushing devlink userspace, tipc also used libmnl as a part of iproute2, so devlink was not the first one. That is why I decided not to rewrite.Quoted 6 lines
Quoted 3 lines
As of the rest of the "common infrastructure", what exactly do you have in mind?
This is what I am getting at. Apparently, these resource patches for devlink require a patched libmnl to work properly. It is wrong for
What do you mean, "work properly". If there is no patched libmnl, only thing what happens is that the extack won't be processed and shown. That is the same behaviour as if you compile iproute2 package without libmnl - all works, used just don't see extack messages.
Quoted 5 lines
Quoted 1 line
I don't see any problem in that. Do you?
I have libmnl installed. I build iproute2. I don't get extended ack messages on devlink failures. That is a problem. That is building a command that is known not to work as it should given the build dependencies.
Known to work, but not for devlink. But nevermind.
Quoted 19 lines · David Ahern
Quoted 8 lines · Jiri Pirko
Quoted 7 lines · Wed, Jan 03, 2018 at 07:14:16PM CET, [email protected] wrote:
Quoted 6 lines · Arkadi Sharshevsky
As I stated this is a user-space bug which I fixed, and updated my repo so please pull. Devlink uses mnl,and currently mnl does not support extended ack. I added support for this in my local ver of libmnl:
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
On branch master, so you can check it out. Besides this bugs, which were userspace, can please specify what are the pending problems from your point of view? Thanks!
devlink is in iproute2 package and it has extack support. See 'git log
lib/libnetlink.c'Dave, devlink uses libmnl.
Quoted 7 lines
Now I remember. You wrote it independently and but needed iproute2 be a delivery vehicle. It uses none of the common infrastructure from iproute2. Could we make this more difficult ....
Sometime in the next day I will jump through the hoops to get a proper devlink command.
This actually was very confusing, I think the extack should be handled by libmnl and iproute should use mnl_cb_run() routines and not to implement its own. That way we could both benefit from that.
You actually do use libmnl in libnetlink.c only for parsing the headers, and its a dependency for extack handling.
I see this as a completely independent user space issue, which doesn't have to do anything with this patchset. Not to mention that everything is working right now.
Quoted 48 lines · Arkadi Sharshevsky
Quoted 31 lines · David Ahern
Quoted 12 lines · Arkadi Sharshevsky
Just to summarize the current fixes required:
1. ERIF dpipe table size is reporting wrong size. More precisely the ERIF table does not take rifs, so it should not be linked to the rif bank resource (is not part of this patchset, future extension).
2. Extended ACK user-space bug.
3. ABI documentation- Not sure we agreed upon it, Jiri?If I missed something please respond. Nothing of the fixes mentioned above is relevant for this patchset actually.
Can you fix the userspace command and then we come back to what else is needed? Right now, it is hard to tell what is a user space bug and what is a kernel space bug.
For example:
$ devlink resource set pci/0000:03:00.0 path /kvd/linear size 10000 $ devlink resource show pci/0000:03:00.0 pci/0000:03:00.0: name kvd size 245760 size_valid true resources: name linear size 98304 occ 0 name hash_double size 60416 name hash_single size 87040The set command did not fail, yet there is no
size_newarg in the output like there is for this change:Quoted 9 lines
$ devlink resource set pci/0000:03:00.0 path /kvd/linear size 0 $ devlink resource show pci/0000:03:00.0 pci/0000:03:00.0: name kvd size 245760 size_valid true resources: name linear size 98304 size_new 0 occ 0 name hash_double size 60416 name hash_single size 87040As I stated this is a user-space bug which I fixed, and updated my repo so please pull. Devlink uses mnl,and currently mnl does not support extended ack. I added support for this in my local ver of libmnl:
Quoted 6 lines
https://github.com/arkadis/libmnl.git
On branch master, so you can check it out. Besides this bugs, which were userspace, can please specify what are the pending problems from your point of view? Thanks!
Again, my comments all stem from user experience.
Can you explain what "double_word" means for a unit? I would expect a units to be kB or count (or items or entries).
$ devlink resource show pci/0000:03:00.0
pci/0000:03:00.0:
name kvd size 245760 unit double_word size_valid true
resources:
name linear size 98304 occ 0 unit double_word
name hash_double size 60416 unit double_word
name hash_single size 87040 unit double_wordWhile that is confusing here from the userspace command it goes hand in hand with patch 2 and:
+enum devlink_resource_unit {
+ DEVLINK_RESOURCE_UNIT_DOUBLE_WORD,
+};
Also, it seems like the occ of 0 is wrong since we know from past responses that if I set linear to 0 all of networking breaks.
How does a user learn the granularity of a resource:
$ devlink resource set pci/0000:03:00.0 path /kvd/hash_double size 50000 Error: mlxsw_spectrum: resource set with wrong granularity.
Try again with 51000 and then 52000 and ... Why not export the granularity read-only? I don't see it in the proposed UAPI.
And then on the reload:
$ devlink reload pci/0000:03:00.0 Error: devlink: resources size validation failed.
Since the reload is not doing any resource sizing that error message is confusing. Maybe something like "Sum of the resource components exceeds total size."
Finally, I still contend a 1-line description of each of the resources goes a long way to improving the user friendliness of this set.
Quoted 56 lines · David Ahern
Quoted 48 lines · Arkadi Sharshevsky
Quoted 31 lines · David Ahern
Quoted 12 lines · Arkadi Sharshevsky
Just to summarize the current fixes required:
1. ERIF dpipe table size is reporting wrong size. More precisely the ERIF table does not take rifs, so it should not be linked to the rif bank resource (is not part of this patchset, future extension).
2. Extended ACK user-space bug.
3. ABI documentation- Not sure we agreed upon it, Jiri?If I missed something please respond. Nothing of the fixes mentioned above is relevant for this patchset actually.
Can you fix the userspace command and then we come back to what else is needed? Right now, it is hard to tell what is a user space bug and what is a kernel space bug.
For example:
$ devlink resource set pci/0000:03:00.0 path /kvd/linear size 10000 $ devlink resource show pci/0000:03:00.0 pci/0000:03:00.0: name kvd size 245760 size_valid true resources: name linear size 98304 occ 0 name hash_double size 60416 name hash_single size 87040The set command did not fail, yet there is no
size_newarg in the output like there is for this change:Quoted 9 lines
$ devlink resource set pci/0000:03:00.0 path /kvd/linear size 0 $ devlink resource show pci/0000:03:00.0 pci/0000:03:00.0: name kvd size 245760 size_valid true resources: name linear size 98304 size_new 0 occ 0 name hash_double size 60416 name hash_single size 87040As I stated this is a user-space bug which I fixed, and updated my repo so please pull. Devlink uses mnl,and currently mnl does not support extended ack. I added support for this in my local ver of libmnl:
Quoted 6 lines
On branch master, so you can check it out. Besides this bugs, which were userspace, can please specify what are the pending problems from your point of view? Thanks!
Quoted 5 lines
Again, my comments all stem from user experience.
Can you explain what "
double_word" means for a unit? I would expect a units to be kB or count (or items or entries).
Double word is 64 bit, dont understand why this is confusing.
Quoted 16 lines
$ devlink resource show pci/0000:03:00.0 pci/0000:03:00.0: name kvd size 245760 unit double_word size_valid true resources: name linear size 98304 occ 0 unit double_word name hash_double size 60416 unit double_word name hash_single size 87040 unit double_wordWhile that is confusing here from the userspace command it goes hand in hand with patch 2 and:
(quoted diff) +3
-0+enum devlink_resource_unit { + DEVLINK_RESOURCE_UNIT_DOUBLE_WORD, +};
Quoted 2 lines
Also, it seems like the occ of 0 is wrong since we know from past responses that if I set linear to 0 all of networking breaks.
You are clearly misunderstanding what is occupancy of the resource and what kvd linear is good for. As I mentioned in the last response kvd linear is mapped to adjacency table. So in case its 0 no nexthop routes could be configured, this information is provided by the dpipe<-->resource.
Occupancy means how much of the resource is used right now, why is this wrong? and how its related to the size 0 exactly?
Quoted 11 lines
How does a user learn the granularity of a resource:
$ devlink resource set pci/0000:03:00.0 path /kvd/hash_double size 50000 Error: mlxsw_spectrum: resource set with wrong granularity.Try again with 51000 and then 52000 and ... Why not export the granularity read-only? I don't see it in the proposed UAPI.
I would like more adding the granularity size to the extack string instead of adding this to UAPI. The user will try to update once and will get the required granularity in the error message.
Quoted 10 lines
And then on the reload:
$ devlink reload pci/0000:03:00.0 Error: devlink: resources size validation failed.Since the reload is not doing any resource sizing that error message is confusing. Maybe something like "Sum of the resource components exceeds total size."
No problem, sounds better.
Quoted 4 lines
Finally, I still contend a 1-line description of each of the resources goes a long way to improving the user friendliness of this set.
Strongly against it.
Quoted 1 line
Double word is 64 bit, dont understand why this is confusing.
In an ASCI, the definition of a word can be quite flexible. I've seen designs using 14 bit words, since 14 bits was all that was needed to represent the data to be held. I've also seen a 16 bit word used to hold a signed value, with the binary point before the last nibble, so it could hold -2047.9375 to +2047.9375. I might have that wrong. It gave me a headache at the time, but the synthesizer had no such problems.
Why not use u8, u16, u14, u32, u64, which we can all understand without confusion.
Andrew
Quoted 7 lines · Arkadi Sharshevsky
Quoted 5 lines
Again, my comments all stem from user experience.
Can you explain what "
double_word" means for a unit? I would expect a units to be kB or count (or items or entries).Double word is 64 bit, dont understand why this is confusing.
As Andrew pointed out, double word can have a range of sizes.
To my point here, a 'unit' for a number should not be the number of bits it is represented by. I believe all of the kvd sizes are in entries (ie., a linear size of 98304 means I can have 98,304 entries in that resource).
Quoted 26 lines
Quoted 17 lines
$ devlink resource show pci/0000:03:00.0 pci/0000:03:00.0: name kvd size 245760 unit double_word size_valid true resources: name linear size 98304 occ 0 unit double_word name hash_double size 60416 unit double_word name hash_single size 87040 unit double_wordWhile that is confusing here from the userspace command it goes hand in hand with patch 2 and:
(quoted diff) +3
-0+enum devlink_resource_unit { + DEVLINK_RESOURCE_UNIT_DOUBLE_WORD, +};Quoted 2 lines
Also, it seems like the occ of 0 is wrong since we know from past responses that if I set linear to 0 all of networking breaks.
You are clearly misunderstanding what is occupancy of the resource and what kvd linear is good for. As I mentioned in the last response kvd linear is mapped to adjacency table. So in case its 0 no nexthop routes could be configured, this information is provided by the dpipe<-->resource.
Quoted 2 lines
Occupancy means how much of the resource is used right now, why is this wrong? and how its related to the size 0 exactly?
The summary line above shows the current kvd/linear occupancy is '0'. That suggests my L3 only deployment is not using any kvd/linear which means I can set its allocation to 0 and devote more kvd resources to the hash regions.
But, as I pointed out in previous responses I can not set linear to 0. If I do all of networking breaks. That suggests that kvd/linear is used by more networking entities than you are currently reporting. Hence, telling me the kvd/linear occupancy is 0 is wrong.
I believe the stems from the how you are determining occupancy and the fact that not all tables have been implemented. Showing the current occupancy of a resource is very helpful, so it should be part of the API.
However, until mlxsw shows a proper value (either by implementing all dpipe tables or changing how it is calculated) it should not be returning that attribute. As it stands you are giving a user invalid data.
Quoted 9 lines
Quoted 9 lines
How does a user learn the granularity of a resource:
$ devlink resource set pci/0000:03:00.0 path /kvd/hash_double size 50000 Error: mlxsw_spectrum: resource set with wrong granularity.
Quoted 7 lines
Quoted 3 lines
Try again with 51000 and then 52000 and ... Why not export the granularity read-only? I don't see it in the proposed UAPI.
I would like more adding the granularity size to the extack string instead of adding this to UAPI. The user will try to update once and will get the required granularity in the error message.
A user should not have to run a command to get an error message to know essential data to running a command with the right value. Further, do not assume 'user' is a person or the devlink command.
Since granularity is essential to running a valid command, it should be an attribute for each resource.
Quoted 21 lines
Quoted 11 lines
And then on the reload:
$ devlink reload pci/0000:03:00.0 Error: devlink: resources size validation failed.Since the reload is not doing any resource sizing that error message is confusing. Maybe something like "Sum of the resource components exceeds total size."
No problem, sounds better.
Quoted 4 lines
Finally, I still contend a 1-line description of each of the resources goes a long way to improving the user friendliness of this set.
Strongly against it.
Quoted 55 lines · David Ahern
Quoted 7 lines · Arkadi Sharshevsky
Quoted 5 lines
Again, my comments all stem from user experience.
Can you explain what "
double_word" means for a unit? I would expect a units to be kB or count (or items or entries).Double word is 64 bit, dont understand why this is confusing.
As Andrew pointed out, double word can have a range of sizes.
To my point here, a 'unit' for a number should not be the number of bits it is represented by. I believe all of the kvd sizes are in entries (ie., a linear size of 98304 means I can have 98,304 entries in that resource).
Quoted 26 lines
Quoted 17 lines
$ devlink resource show pci/0000:03:00.0 pci/0000:03:00.0: name kvd size 245760 unit double_word size_valid true resources: name linear size 98304 occ 0 unit double_word name hash_double size 60416 unit double_word name hash_single size 87040 unit double_wordWhile that is confusing here from the userspace command it goes hand in hand with patch 2 and:
(quoted diff) +3
-0+enum devlink_resource_unit { + DEVLINK_RESOURCE_UNIT_DOUBLE_WORD, +};Quoted 2 lines
Also, it seems like the occ of 0 is wrong since we know from past responses that if I set linear to 0 all of networking breaks.
You are clearly misunderstanding what is occupancy of the resource and what kvd linear is good for. As I mentioned in the last response kvd linear is mapped to adjacency table. So in case its 0 no nexthop routes could be configured, this information is provided by the dpipe<-->resource.
Quoted 2 lines
Occupancy means how much of the resource is used right now, why is this wrong? and how its related to the size 0 exactly?
The summary line above shows the current kvd/linear occupancy is '0'. That suggests my L3 only deployment is not using any kvd/linear which means I can set its allocation to 0 and devote more kvd resources to the hash regions.
But, as I pointed out in previous responses I can not set linear to 0. If I do all of networking breaks. That suggests that kvd/linear is used by more networking entities than you are currently reporting. Hence, telling me the kvd/linear occupancy is 0 is wrong.
Quoted 8 lines
I believe the stems from the how you are determining occupancy and the fact that not all tables have been implemented. Showing the current occupancy of a resource is very helpful, so it should be part of the API.
However, until mlxsw shows a proper value (either by implementing all dpipe tables or changing how it is calculated) it should not be returning that attribute. As it stands you are giving a user invalid data.
Wait, the occupancy is very precise it goes directly to the linear allocator inside the driver and gives exact current usage. You assumed it goes to the dpipe tables which is incorrect.
The linear kvd memory is used by:
1. The adjacency table is responsible for the ECMP and nexthop resolution.
2. ACL flexible actions blocks (dpipe will contain table for this).
I dont know what you configured but in case you got some remote routes with a nexthop the occ should not be zero.
If your router contains only local routes and dont use ACL you can shrink it to zero, no problem.
Quoted 17 lines
Quoted 9 lines
Quoted 9 lines
How does a user learn the granularity of a resource:
$ devlink resource set pci/0000:03:00.0 path /kvd/hash_double size 50000 Error: mlxsw_spectrum: resource set with wrong granularity.Quoted 7 lines
Quoted 3 lines
Try again with 51000 and then 52000 and ... Why not export the granularity read-only? I don't see it in the proposed UAPI.
I would like more adding the granularity size to the extack string instead of adding this to UAPI. The user will try to update once and will get the required granularity in the error message.
Quoted 7 lines
A user should not have to run a command to get an error message to know essential data to running a command with the right value. Further, do not assume 'user' is a person or the devlink command.
Since granularity is essential to running a valid command, it should be an attribute for each resource.
This is also your approach towards the min/max for resource sizes? Am I correct?
Quoted 23 lines
Quoted 22 lines
Quoted 12 lines
And then on the reload:
$ devlink reload pci/0000:03:00.0 Error: devlink: resources size validation failed.Since the reload is not doing any resource sizing that error message is confusing. Maybe something like "Sum of the resource components exceeds total size."
No problem, sounds better.
Quoted 4 lines
Finally, I still contend a 1-line description of each of the resources goes a long way to improving the user friendliness of this set.
Strongly against it.
Quoted 62 lines · Arkadi Sharshevsky
Quoted 59 lines · David Ahern
Quoted 7 lines · Arkadi Sharshevsky
Quoted 5 lines
Again, my comments all stem from user experience.
Can you explain what "
double_word" means for a unit? I would expect a units to be kB or count (or items or entries).Double word is 64 bit, dont understand why this is confusing.
As Andrew pointed out, double word can have a range of sizes.
To my point here, a 'unit' for a number should not be the number of bits it is represented by. I believe all of the kvd sizes are in entries (ie., a linear size of 98304 means I can have 98,304 entries in that resource).
Quoted 26 lines
Quoted 17 lines
$ devlink resource show pci/0000:03:00.0 pci/0000:03:00.0: name kvd size 245760 unit double_word size_valid true resources: name linear size 98304 occ 0 unit double_word name hash_double size 60416 unit double_word name hash_single size 87040 unit double_wordWhile that is confusing here from the userspace command it goes hand in hand with patch 2 and:
(quoted diff) +3
-0+enum devlink_resource_unit { + DEVLINK_RESOURCE_UNIT_DOUBLE_WORD, +};Quoted 2 lines
Also, it seems like the occ of 0 is wrong since we know from past responses that if I set linear to 0 all of networking breaks.
You are clearly misunderstanding what is occupancy of the resource and what kvd linear is good for. As I mentioned in the last response kvd linear is mapped to adjacency table. So in case its 0 no nexthop routes could be configured, this information is provided by the dpipe<-->resource.
Quoted 2 lines
Occupancy means how much of the resource is used right now, why is this wrong? and how its related to the size 0 exactly?
The summary line above shows the current kvd/linear occupancy is '0'. That suggests my L3 only deployment is not using any kvd/linear which means I can set its allocation to 0 and devote more kvd resources to the hash regions.
But, as I pointed out in previous responses I can not set linear to 0. If I do all of networking breaks. That suggests that kvd/linear is used by more networking entities than you are currently reporting. Hence, telling me the kvd/linear occupancy is 0 is wrong.
I believe the stems from the how you are determining occupancy and the fact that not all tables have been implemented. Showing the current occupancy of a resource is very helpful, so it should be part of the API.
Quoted 8 lines
Quoted 4 lines
However, until mlxsw shows a proper value (either by implementing all dpipe tables or changing how it is calculated) it should not be returning that attribute. As it stands you are giving a user invalid data.
Wait, the occupancy is very precise it goes directly to the linear allocator inside the driver and gives exact current usage. You assumed it goes to the dpipe tables which is incorrect.
I am trying *guess* based on this discussion as to why it is 0. In past responses you push that the tables expose how the resource is used.
Quoted 11 lines
The linear kvd memory is used by:
1. The adjacency table is responsible for the ECMP and nexthop resolution.
2. ACL flexible actions blocks (dpipe will contain table for this).I dont know what you configured but in case you got some remote routes with a nexthop the occ should not be zero.
If your router contains only local routes and dont use ACL you can shrink it to zero, no problem.
My current setup is an L3 only deployment, no ACLs and no bridges. We are meeting in 15 minutes to discuss this design; let's use some of the time for debugging this problem.
Quoted 22 lines
Quoted 22 lines
Quoted 10 lines
Quoted 10 lines
How does a user learn the granularity of a resource:
$ devlink resource set pci/0000:03:00.0 path /kvd/hash_double size 50000 Error: mlxsw_spectrum: resource set with wrong granularity.Quoted 7 lines
Quoted 3 lines
Try again with 51000 and then 52000 and ... Why not export the granularity read-only? I don't see it in the proposed UAPI.
I would like more adding the granularity size to the extack string instead of adding this to UAPI. The user will try to update once and will get the required granularity in the error message.
A user should not have to run a command to get an error message to know essential data to running a command with the right value. Further, do not assume 'user' is a person or the devlink command.
Quoted 6 lines
Quoted 3 lines
Since granularity is essential to running a valid command, it should be an attribute for each resource.
This is also your approach towards the min/max for resource sizes? Am I correct?
yes.
Quoted 2 lines · Arkadi Sharshevsky
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Also, it seems like the occ of 0 is wrong since we know from past responses that if I set linear to 0 all of networking breaks.
Ok, this was a David bug. I was running ifreload after the devlink reload command, but all of my connections to the switch are through breakout ports and the ifreload was not running the devlink port split command. Doing that before the ifreload and all is fine.