• Damian Muszynski's avatar
    crypto: qat - add sysfs_added flag for rate limiting · d71fdd0f
    Damian Muszynski authored
    The qat_rl sysfs attribute group is registered within the adf_dev_start()
    function, alongside other driver components.
    If any of the functions preceding the group registration fails,
    the adf_dev_start() function returns, and the caller, to undo the
    operation, invokes adf_dev_stop() followed by adf_dev_shutdown().
    However, the current flow lacks information about whether the
    registration of the qat_rl attribute group was successful or not.
    
    In cases where this condition is encountered, an error similar to
    the following might be reported:
    
        4xxx 0000:6b:00.0: Starting device qat_dev0
        4xxx 0000:6b:00.0: qat_dev0 started 9 acceleration engines
        4xxx 0000:6b:00.0: Failed to send init message
        4xxx 0000:6b:00.0: Failed to start device qat_dev0
        sysfs group 'qat_rl' not found for kobject '0000:6b:00.0'
        ...
        sysfs_remove_groups+0x2d/0x50
        adf_sysfs_rl_rm+0x44/0x70 [intel_qat]
        adf_rl_stop+0x2d/0xb0 [intel_qat]
        adf_dev_stop+0x33/0x1d0 [intel_qat]
        adf_dev_down+0xf1/0x150 [intel_qat]
        ...
        4xxx 0000:6b:00.0: qat_dev0 stopped 9 acceleration engines
        4xxx 0000:6b:00.0: Resetting device qat_dev0
    
    To prevent attempting to remove attributes from a group that has not
    been added yet, a flag named 'sysfs_added' is introduced. This flag
    is set to true upon the successful registration of the attribute group.
    
    Fixes: d9fb8408 ("crypto: qat - add rate limiting feature to qat_4xxx")
    Signed-off-by: default avatarDamian Muszynski <damian.muszynski@intel.com>
    Reviewed-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: default avatarAhsan Atta <ahsan.atta@intel.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    d71fdd0f
adf_rl.h 5.69 KB