• Michael Chan's avatar
    bnxt_en: Improve the delay logic for firmware response. · a11fa2be
    Michael Chan authored
    The current code has 2 problems:
    
    1. The maximum wait time is not long enough.  It is about 60% of the
    duration specified by the firmware.  It is calling usleep_range(600, 800)
    for every 1 msec we are supposed to wait.
    
    2. The granularity of the delay is too coarse.  Many simple firmware
    commands finish in 25 usec or less.
    
    We fix these 2 issues by multiplying the original 1 msec loop counter by
    40 and calling usleep_range(25, 40) for each iteration.
    
    There is also a second delay loop to wait for the last DMA word to
    complete.  This delay loop should be a very short 5 usec wait.
    
    This change results in much faster bring-up/down time:
    
    Before the patch:
    
    time ip link set p4p1 up
    
    real    0m0.120s
    user    0m0.001s
    sys     0m0.009s
    
    After the patch:
    
    time ip link set p4p1 up
    
    real    0m0.030s
    user    0m0.000s
    sys     0m0.010s
    Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    a11fa2be
bnxt.c 164 KB