• Dmytro Linkin's avatar
    devlink: Allow setting tx rate for devlink rate leaf objects · 1897db2e
    Dmytro Linkin authored
    Implement support for DEVLINK_CMD_RATE_SET command with new attributes
    DEVLINK_ATTR_RATE_TX_{SHARE|MAX} that are used to set devlink rate
    shared/max tx rate values. Extend devlink ops with new callbacks
    rate_leaf_tx_{share|max}_set() to allow supporting drivers to implement
    rate control through devlink.
    
    New attributes are optional. Driver implementations are allowed to
    support either or both of them.
    
    Shared rate example:
    
    $ devlink port function rate set netdevsim/netdevsim10/0 tx_share 10mbit
    
    $ devlink port function rate show netdevsim/netdevsim10/0
    netdevsim/netdevsim10/0: type leaf tx_share 10mbit
    
    Max rate example:
    
    $ devlink port function rate set netdevsim/netdevsim10/0 tx_max 100mbit
    
    $ devlink port function rate show netdevsim/netdevsim10/0
    netdevsim/netdevsim10/0: type leaf tx_max 100mbit
    Co-developed-by: default avatarVlad Buslov <vladbu@nvidia.com>
    Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
    Signed-off-by: default avatarDmytro Linkin <dlinkin@nvidia.com>
    Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    1897db2e
devlink.c 282 KB