• Kalesh AP's avatar
    bnxt_en: Fix devlink fw_activate · 1278d17a
    Kalesh AP authored
    To install a livepatch, first flash the package to NVM, and then
    activate the patch through the "HWRM_FW_LIVEPATCH" fw command.
    To uninstall a patch from NVM, flash the removal package and then
    activate it through the "HWRM_FW_LIVEPATCH" fw command.
    
    The "HWRM_FW_LIVEPATCH" fw command has to consider following scenarios:
    
    1. no patch in NVM and no patch active. Do nothing.
    2. patch in NVM, but not active. Activate the patch currently in NVM.
    3. patch is not in NVM, but active. Deactivate the patch.
    4. patch in NVM and the patch active. Do nothing.
    
    Fix the code to handle these scenarios during devlink "fw_activate".
    
    To install and activate a live patch:
    devlink dev flash pci/0000:c1:00.0 file thor_patch.pkg
    devlink -f dev reload pci/0000:c1:00.0 action fw_activate limit no_reset
    
    To remove and deactivate a live patch:
    devlink dev flash pci/0000:c1:00.0 file thor_patch_rem.pkg
    devlink -f dev reload pci/0000:c1:00.0 action fw_activate limit no_reset
    
    Fixes: 3c415339 ("bnxt_en: implement firmware live patching")
    Reviewed-by: default avatarVikas Gupta <vikas.gupta@broadcom.com>
    Reviewed-by: default avatarSomnath Kotur <somnath.kotur@broadcom.com>
    Signed-off-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
    Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    1278d17a
bnxt_devlink.c 33.5 KB