• Denis Bolotin's avatar
    qed: Fix QM getters to always return a valid pq · eb62cca9
    Denis Bolotin authored
    The getter callers doesn't know the valid Physical Queues (PQ) values.
    This patch makes sure that a valid PQ will always be returned.
    
    The patch consists of 3 fixes:
    
     - When qed_init_qm_get_idx_from_flags() receives a disabled flag, it
       returned PQ 0, which can potentially be another function's pq. Verify
       that flag is enabled, otherwise return default start_pq.
    
     - When qed_init_qm_get_idx_from_flags() receives an unknown flag, it
       returned NULL and could lead to a segmentation fault. Return default
       start_pq instead.
    
     - A modulo operation was added to MCOS/VFS PQ getters to make sure the
       PQ returned is in range of the required flag.
    
    Fixes: b5a9ee7c ("qed: Revise QM cofiguration")
    Signed-off-by: default avatarDenis Bolotin <denis.bolotin@cavium.com>
    Signed-off-by: default avatarMichal Kalderon <michal.kalderon@cavium.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    eb62cca9
qed_dev.c 116 KB