stmmac: review RX/TX ring management
authorGiuseppe Cavallaro <peppe.cavallaro@st.com>
Mon, 29 Feb 2016 13:27:30 +0000 (14:27 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 2 Mar 2016 19:21:31 +0000 (14:21 -0500)
commite3ad57c96715df2989ce6c18e58faf2913b305cb
tree716a8f7f1662876b3006888c251fff7afc2e0896
parent293e4365a1adb1d3747dcb7d12a52950e0e232a2
stmmac: review RX/TX ring management

This patch is to rework the ring management now optimized.
The indexes into the ring buffer are always incremented, and
the entry is accessed via doing a modulo to find the "real"
position in the ring.
It is inefficient, modulo is an expensive operation.

The formula [(entry + 1) & (size - 1)] is now adopted on
a ring that is power-of-2 in size.
Then, the number of elements cannot be set by command line but
it is fixed.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/chain_mode.c
drivers/net/ethernet/stmicro/stmmac/common.h
drivers/net/ethernet/stmicro/stmmac/ring_mode.c
drivers/net/ethernet/stmicro/stmmac/stmmac.h
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c