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.
Showing the changes to include/uapi/linux/devlink.h (1 of 3 files). Show all
Unified · Split
| @@ -33,6 +33,26 @@ enum devlink_command { · 32 unmodified lines | |||
| 33 | DEVLINK_CMD_PORT_SPLIT, | 33 | DEVLINK_CMD_PORT_SPLIT, |
| 34 | DEVLINK_CMD_PORT_UNSPLIT, | 34 | DEVLINK_CMD_PORT_UNSPLIT, |
| 35 | 35 | ||
| 36 | DEVLINK_CMD_SB_GET, /* can dump */ | ||
| 37 | DEVLINK_CMD_SB_SET, | ||
| 38 | DEVLINK_CMD_SB_NEW, | ||
| 39 | DEVLINK_CMD_SB_DEL, | ||
| 40 | |||
| 41 | DEVLINK_CMD_SB_POOL_GET, /* can dump */ | ||
| 42 | DEVLINK_CMD_SB_POOL_SET, | ||
| 43 | DEVLINK_CMD_SB_POOL_NEW, | ||
| 44 | DEVLINK_CMD_SB_POOL_DEL, | ||
| 45 | |||
| 46 | DEVLINK_CMD_SB_PORT_POOL_GET, /* can dump */ | ||
| 47 | DEVLINK_CMD_SB_PORT_POOL_SET, | ||
| 48 | DEVLINK_CMD_SB_PORT_POOL_NEW, | ||
| 49 | DEVLINK_CMD_SB_PORT_POOL_DEL, | ||
| 50 | |||
| 51 | DEVLINK_CMD_SB_TC_POOL_BIND_GET, /* can dump */ | ||
| 52 | DEVLINK_CMD_SB_TC_POOL_BIND_SET, | ||
| 53 | DEVLINK_CMD_SB_TC_POOL_BIND_NEW, | ||
| 54 | DEVLINK_CMD_SB_TC_POOL_BIND_DEL, | ||
| 55 | |||
| 36 | /* add new commands above here */ | 56 | /* add new commands above here */ |
| 37 | 57 | ||
| 38 | __DEVLINK_CMD_MAX, | 58 | __DEVLINK_CMD_MAX, |
| @@ -46,6 +66,31 @@ enum devlink_port_type { · 7 unmodified lines | |||
| 46 | DEVLINK_PORT_TYPE_IB, | 66 | DEVLINK_PORT_TYPE_IB, |
| 47 | }; | 67 | }; |
| 48 | 68 | ||
| 69 | enum devlink_sb_pool_type { | ||
| 70 | DEVLINK_SB_POOL_TYPE_INGRESS, | ||
| 71 | DEVLINK_SB_POOL_TYPE_EGRESS, | ||
| 72 | }; | ||
| 73 | |||
| 74 | /* static threshold - limiting the maximum number of bytes. | ||
| 75 | * dynamic threshold - limiting the maximum number of bytes | ||
| 76 | * based on the currently available free space in the shared buffer pool. | ||
| 77 | * In this mode, the maximum quota is calculated based | ||
| 78 | * on the following formula: | ||
| 79 | * max_quota = alpha / (1 + alpha) * Free_Buffer | ||
| 80 | * While Free_Buffer is the amount of none-occupied buffer associated to | ||
| 81 | * the relevant pool. | ||
| 82 | * The value range which can be passed is 0-20 and serves | ||
| 83 | * for computation of alpha by following formula: | ||
| 84 | * alpha = 2 ^ (passed_value - 10) | ||
| 85 | */ | ||
| 86 | |||
| 87 | enum devlink_sb_threshold_type { | ||
| 88 | DEVLINK_SB_THRESHOLD_TYPE_STATIC, | ||
| 89 | DEVLINK_SB_THRESHOLD_TYPE_DYNAMIC, | ||
| 90 | }; | ||
| 91 | |||
| 92 | #define DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX 20 | ||
| 93 | |||
| 49 | enum devlink_attr { | 94 | enum devlink_attr { |
| 50 | /* don't change the order or add anything between, this is ABI! */ | 95 | /* don't change the order or add anything between, this is ABI! */ |
| 51 | DEVLINK_ATTR_UNSPEC, | 96 | DEVLINK_ATTR_UNSPEC, |
| @@ -62,6 +107,18 @@ enum devlink_attr { · 10 unmodified lines | |||
| 62 | DEVLINK_ATTR_PORT_IBDEV_NAME, /* string */ | 107 | DEVLINK_ATTR_PORT_IBDEV_NAME, /* string */ |
| 63 | DEVLINK_ATTR_PORT_SPLIT_COUNT, /* u32 */ | 108 | DEVLINK_ATTR_PORT_SPLIT_COUNT, /* u32 */ |
| 64 | DEVLINK_ATTR_PORT_SPLIT_GROUP, /* u32 */ | 109 | DEVLINK_ATTR_PORT_SPLIT_GROUP, /* u32 */ |
| 110 | DEVLINK_ATTR_SB_INDEX, /* u32 */ | ||
| 111 | DEVLINK_ATTR_SB_SIZE, /* u32 */ | ||
| 112 | DEVLINK_ATTR_SB_INGRESS_POOL_COUNT, /* u16 */ | ||
| 113 | DEVLINK_ATTR_SB_EGRESS_POOL_COUNT, /* u16 */ | ||
| 114 | DEVLINK_ATTR_SB_INGRESS_TC_COUNT, /* u16 */ | ||
| 115 | DEVLINK_ATTR_SB_EGRESS_TC_COUNT, /* u16 */ | ||
| 116 | DEVLINK_ATTR_SB_POOL_INDEX, /* u16 */ | ||
| 117 | DEVLINK_ATTR_SB_POOL_TYPE, /* u8 */ | ||
| 118 | DEVLINK_ATTR_SB_POOL_SIZE, /* u32 */ | ||
| 119 | DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE, /* u8 */ | ||
| 120 | DEVLINK_ATTR_SB_THRESHOLD, /* u32 */ | ||
| 121 | DEVLINK_ATTR_SB_TC_INDEX, /* u16 */ | ||
| 65 | 122 | ||
| 66 | /* add new attributes above here, update the policy in devlink.c */ | 123 | /* add new attributes above here, update the policy in devlink.c */ |
| 67 | 124 | ||