• Arindam Nath's avatar
    NTB: return link up status correctly for PRI and SEC · 5f0856be
    Arindam Nath authored
    Since NTB connects two physically separate systems,
    there can be scenarios where one system goes down
    while the other one remains active. In case of NTB
    primary, if the NTB secondary goes down, a Link-Down
    event is received. For the NTB secondary, if the
    NTB primary goes down, the PCIe hotplug mechanism
    ensures that the driver on the secondary side is also
    unloaded.
    
    But there are other scenarios to consider as well,
    when suppose the physical link remains active, but
    the driver on primary or secondary side is loaded
    or un-loaded.
    
    When the driver is loaded, on either side, it sets
    SIDE_READY bit(bit-1) of SIDE_INFO register. Similarly,
    when the driver is un-loaded, it resets the same bit.
    
    We consider the NTB link to be up and operational
    only when the driver on both sides of link are loaded
    and ready. But we also need to take account of
    Link Up and Down events which signify the physical
    link status. So amd_link_is_up() is modified to take
    care of the above scenarios.
    Signed-off-by: default avatarArindam Nath <arindam.nath@amd.com>
    Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
    5f0856be
ntb_hw_amd.h 5.98 KB