Commit d916701c authored by Giuseppe CAVALLARO's avatar Giuseppe CAVALLARO Committed by David S. Miller

stmmac: fix and better tune the default buffer sizes

This patch is to fix and tune the default buffer sizes.
It reduces the default bufsize used by the driver from
4KiB to 1536 bytes.

Patch has been tested on both ARM and SH4 platform based.
Signed-off-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 83bf79b6
...@@ -92,8 +92,8 @@ static int tc = TC_DEFAULT; ...@@ -92,8 +92,8 @@ static int tc = TC_DEFAULT;
module_param(tc, int, S_IRUGO | S_IWUSR); module_param(tc, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(tc, "DMA threshold control value"); MODULE_PARM_DESC(tc, "DMA threshold control value");
#define DMA_BUFFER_SIZE BUF_SIZE_4KiB #define DEFAULT_BUFSIZE 1536
static int buf_sz = DMA_BUFFER_SIZE; static int buf_sz = DEFAULT_BUFSIZE;
module_param(buf_sz, int, S_IRUGO | S_IWUSR); module_param(buf_sz, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(buf_sz, "DMA buffer size"); MODULE_PARM_DESC(buf_sz, "DMA buffer size");
...@@ -136,8 +136,8 @@ static void stmmac_verify_args(void) ...@@ -136,8 +136,8 @@ static void stmmac_verify_args(void)
dma_rxsize = DMA_RX_SIZE; dma_rxsize = DMA_RX_SIZE;
if (unlikely(dma_txsize < 0)) if (unlikely(dma_txsize < 0))
dma_txsize = DMA_TX_SIZE; dma_txsize = DMA_TX_SIZE;
if (unlikely((buf_sz < DMA_BUFFER_SIZE) || (buf_sz > BUF_SIZE_16KiB))) if (unlikely((buf_sz < DEFAULT_BUFSIZE) || (buf_sz > BUF_SIZE_16KiB)))
buf_sz = DMA_BUFFER_SIZE; buf_sz = DEFAULT_BUFSIZE;
if (unlikely(flow_ctrl > 1)) if (unlikely(flow_ctrl > 1))
flow_ctrl = FLOW_AUTO; flow_ctrl = FLOW_AUTO;
else if (likely(flow_ctrl < 0)) else if (likely(flow_ctrl < 0))
...@@ -901,10 +901,10 @@ static int stmmac_set_bfsize(int mtu, int bufsize) ...@@ -901,10 +901,10 @@ static int stmmac_set_bfsize(int mtu, int bufsize)
ret = BUF_SIZE_8KiB; ret = BUF_SIZE_8KiB;
else if (mtu >= BUF_SIZE_2KiB) else if (mtu >= BUF_SIZE_2KiB)
ret = BUF_SIZE_4KiB; ret = BUF_SIZE_4KiB;
else if (mtu >= DMA_BUFFER_SIZE) else if (mtu > DEFAULT_BUFSIZE)
ret = BUF_SIZE_2KiB; ret = BUF_SIZE_2KiB;
else else
ret = DMA_BUFFER_SIZE; ret = DEFAULT_BUFSIZE;
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment