• Jonas Bonn's avatar
    ethoc: remove division from loops · 6a632625
    Jonas Bonn authored
    Calculating the BD entry using a modulus operation isn't optimal, especially
    inside the loop.  This patch removes the modulus operations in favour of:
    
    i)  simply checking for wrapping in the case of cur_rx
    ii) forcing num_tx to be a power of two and using it to mask out the
        entry from cur_tx
    
    The also prevents possible issues related overflow of the cur_rx and cur_tx
    counters.
    Signed-off-by: default avatarJonas Bonn <jonas@southpole.se>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    6a632625
ethoc.c 28.8 KB