• Jacob Keller's avatar
    devlink: support directly reading from region memory · af6397c9
    Jacob Keller authored
    To read from a region, user space must currently request a new snapshot of
    the region and then read from that snapshot. This can sometimes be overkill
    if user space only reads a tiny portion. They first create the snapshot,
    then request a read, then destroy the snapshot.
    
    For regions which have a single underlying "contents", it makes sense to
    allow supporting direct reading of the region data.
    
    Extend the DEVLINK_CMD_REGION_READ to allow direct reading from a region if
    requested via the new DEVLINK_ATTR_REGION_DIRECT. If this attribute is set,
    then perform a direct read instead of using a snapshot. Direct read is
    mutually exclusive with DEVLINK_ATTR_REGION_SNAPSHOT_ID, and care is taken
    to ensure that we reject commands which provide incorrect attributes.
    
    Regions must enable support for direct read by implementing the .read()
    callback function. If a region does not support such direct reads, a
    suitable extended error message is reported.
    Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
    Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    af6397c9
devlink.h 67.4 KB