net/nfp: avoid modulo operations for handling ring wrapping
authorAlejandro Lucero <alejandro.lucero@netronome.com>
Mon, 19 Dec 2016 16:13:03 +0000 (16:13 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 17 Jan 2017 18:40:52 +0000 (19:40 +0100)
commit74a640dac864cdf12e3c27eb37757416bcc1b666
tree66b52c4e23233f8ffb4022922dba71313ef5a0a5
parent6087d8a9cc5b54457e5e1b28550679f567fa48ca
net/nfp: avoid modulo operations for handling ring wrapping

Having those modulo operations implies costly instructions execution,
what can be avoided with conditionals and unlikely clauses.

This change makes the software ring read and write indexes to be now
always within the ring size which has to be handled properly. The main
problem is when write pointer wraps and being less than the read pointer.
This happened before, but just with indexes type size (uint32_t) wrapping,
and in that case the processor does the right thing no requiring special
handling by software.

This work has also led to discovering redundant pointers in the driver,
which have been removed.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
drivers/net/nfp/nfp_net.c
drivers/net/nfp/nfp_net_pmd.h