• Finn Thain's avatar
    net/sonic: Avoid needless receive descriptor EOL flag updates · eaabfd19
    Finn Thain authored
    The while loop in sonic_rx() traverses the rx descriptor ring. It stops
    when it reaches a descriptor that the SONIC has not used. Each iteration
    advances the EOL flag so the SONIC can keep using more descriptors.
    Therefore, the while loop has no definite termination condition.
    
    The algorithm described in the National Semiconductor literature is quite
    different. It consumes descriptors up to the one with its EOL flag set
    (which will also have its "in use" flag set). All freed descriptors are
    then returned to the ring at once, by adjusting the EOL flags (and link
    pointers).
    
    Adopt the algorithm from datasheet as it's simpler, terminates quickly
    and avoids a lot of pointless descriptor EOL flag changes.
    
    Fixes: efcce839 ("[PATCH] macsonic/jazzsonic network drivers update")
    Tested-by: default avatarStan Johnson <userm57@yahoo.com>
    Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    eaabfd19
sonic.c 21.9 KB