devlink: add shared buffer configuration
Define userspace API and drivers API for configuration of shared buffers. Four basic objects are defined: shared buffer - attributes are size, number of pools and TCs pool - chunk of sharedbuffer definition, it has some size and either static or dynamic threshold port pool threshold - to set per-port threshold for each pool port tc threshold bind - to bind port and TC to specified pool with threshold. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
f38ba953be
commit
bf7974710a
@@ -33,6 +33,26 @@ enum devlink_command {
|
||||
DEVLINK_CMD_PORT_SPLIT,
|
||||
DEVLINK_CMD_PORT_UNSPLIT,
|
||||
|
||||
DEVLINK_CMD_SB_GET, /* can dump */
|
||||
DEVLINK_CMD_SB_SET,
|
||||
DEVLINK_CMD_SB_NEW,
|
||||
DEVLINK_CMD_SB_DEL,
|
||||
|
||||
DEVLINK_CMD_SB_POOL_GET, /* can dump */
|
||||
DEVLINK_CMD_SB_POOL_SET,
|
||||
DEVLINK_CMD_SB_POOL_NEW,
|
||||
DEVLINK_CMD_SB_POOL_DEL,
|
||||
|
||||
DEVLINK_CMD_SB_PORT_POOL_GET, /* can dump */
|
||||
DEVLINK_CMD_SB_PORT_POOL_SET,
|
||||
DEVLINK_CMD_SB_PORT_POOL_NEW,
|
||||
DEVLINK_CMD_SB_PORT_POOL_DEL,
|
||||
|
||||
DEVLINK_CMD_SB_TC_POOL_BIND_GET, /* can dump */
|
||||
DEVLINK_CMD_SB_TC_POOL_BIND_SET,
|
||||
DEVLINK_CMD_SB_TC_POOL_BIND_NEW,
|
||||
DEVLINK_CMD_SB_TC_POOL_BIND_DEL,
|
||||
|
||||
/* add new commands above here */
|
||||
|
||||
__DEVLINK_CMD_MAX,
|
||||
@@ -46,6 +66,31 @@ enum devlink_port_type {
|
||||
DEVLINK_PORT_TYPE_IB,
|
||||
};
|
||||
|
||||
enum devlink_sb_pool_type {
|
||||
DEVLINK_SB_POOL_TYPE_INGRESS,
|
||||
DEVLINK_SB_POOL_TYPE_EGRESS,
|
||||
};
|
||||
|
||||
/* static threshold - limiting the maximum number of bytes.
|
||||
* dynamic threshold - limiting the maximum number of bytes
|
||||
* based on the currently available free space in the shared buffer pool.
|
||||
* In this mode, the maximum quota is calculated based
|
||||
* on the following formula:
|
||||
* max_quota = alpha / (1 + alpha) * Free_Buffer
|
||||
* While Free_Buffer is the amount of none-occupied buffer associated to
|
||||
* the relevant pool.
|
||||
* The value range which can be passed is 0-20 and serves
|
||||
* for computation of alpha by following formula:
|
||||
* alpha = 2 ^ (passed_value - 10)
|
||||
*/
|
||||
|
||||
enum devlink_sb_threshold_type {
|
||||
DEVLINK_SB_THRESHOLD_TYPE_STATIC,
|
||||
DEVLINK_SB_THRESHOLD_TYPE_DYNAMIC,
|
||||
};
|
||||
|
||||
#define DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX 20
|
||||
|
||||
enum devlink_attr {
|
||||
/* don't change the order or add anything between, this is ABI! */
|
||||
DEVLINK_ATTR_UNSPEC,
|
||||
@@ -62,6 +107,18 @@ enum devlink_attr {
|
||||
DEVLINK_ATTR_PORT_IBDEV_NAME, /* string */
|
||||
DEVLINK_ATTR_PORT_SPLIT_COUNT, /* u32 */
|
||||
DEVLINK_ATTR_PORT_SPLIT_GROUP, /* u32 */
|
||||
DEVLINK_ATTR_SB_INDEX, /* u32 */
|
||||
DEVLINK_ATTR_SB_SIZE, /* u32 */
|
||||
DEVLINK_ATTR_SB_INGRESS_POOL_COUNT, /* u16 */
|
||||
DEVLINK_ATTR_SB_EGRESS_POOL_COUNT, /* u16 */
|
||||
DEVLINK_ATTR_SB_INGRESS_TC_COUNT, /* u16 */
|
||||
DEVLINK_ATTR_SB_EGRESS_TC_COUNT, /* u16 */
|
||||
DEVLINK_ATTR_SB_POOL_INDEX, /* u16 */
|
||||
DEVLINK_ATTR_SB_POOL_TYPE, /* u8 */
|
||||
DEVLINK_ATTR_SB_POOL_SIZE, /* u32 */
|
||||
DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE, /* u8 */
|
||||
DEVLINK_ATTR_SB_THRESHOLD, /* u32 */
|
||||
DEVLINK_ATTR_SB_TC_INDEX, /* u16 */
|
||||
|
||||
/* add new attributes above here, update the policy in devlink.c */
|
||||
|
||||
|
Reference in New Issue
Block a user