• Ido Schimmel's avatar
    mlxsw: spectrum_buffers: Limit size of pools · 87259f18
    Ido Schimmel authored
    The shared buffer pools are containers whose size is used to calculate
    the maximum usage for packets from / to a specific port / {port, PG/TC},
    when dynamic threshold is employed.
    
    While it's perfectly fine for the sum of the pools to exceed the maximum
    size of the shared buffer, a single pool cannot.
    
    Add a check when the pool size is set and forbid sizes larger than the
    maximum size of the shared buffer.
    
    Without the patch:
    $ devlink sb pool set pci/0000:03:00.0 pool 0 size 999999999 thtype
    dynamic
    // No error is returned
    
    With the patch:
    $ devlink sb pool set pci/0000:03:00.0 pool 0 size 999999999 thtype
    dynamic
    devlink answers: Invalid argument
    Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
    Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    87259f18
spectrum_buffers.c 27.9 KB