diff options
author | Jon Mason <mason@myri.com> | 2011-06-27 01:05:03 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-06-29 09:02:04 -0400 |
commit | 4b47638ab25d90faf4e5499aecd8812f247181fd (patch) | |
tree | 12d0b5dc75e334add70d9a7a3c7f1872ca5ffb8e | |
parent | c689b81b4267b1335b11f18fe8a79c56880d9d43 (diff) |
myri10ge: allow small_bytes = 0
Allow page-based receive to work when small_bytes is set to 0.
Signed-off-by: Jon Mason <mason@myri.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/myri10ge/myri10ge.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index ca0345795fa6..57bb7f782c3c 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -2004,8 +2004,12 @@ static int myri10ge_allocate_rings(struct myri10ge_slice_state *ss) | |||
2004 | ss->rx_big.page_offset = MYRI10GE_ALLOC_SIZE; | 2004 | ss->rx_big.page_offset = MYRI10GE_ALLOC_SIZE; |
2005 | ss->rx_small.watchdog_needed = 0; | 2005 | ss->rx_small.watchdog_needed = 0; |
2006 | ss->rx_big.watchdog_needed = 0; | 2006 | ss->rx_big.watchdog_needed = 0; |
2007 | myri10ge_alloc_rx_pages(mgp, &ss->rx_small, | 2007 | if (mgp->small_bytes == 0) { |
2008 | mgp->small_bytes + MXGEFW_PAD, 0); | 2008 | ss->rx_small.fill_cnt = ss->rx_small.mask + 1; |
2009 | } else { | ||
2010 | myri10ge_alloc_rx_pages(mgp, &ss->rx_small, | ||
2011 | mgp->small_bytes + MXGEFW_PAD, 0); | ||
2012 | } | ||
2009 | 2013 | ||
2010 | if (ss->rx_small.fill_cnt < ss->rx_small.mask + 1) { | 2014 | if (ss->rx_small.fill_cnt < ss->rx_small.mask + 1) { |
2011 | netdev_err(dev, "slice-%d: alloced only %d small bufs\n", | 2015 | netdev_err(dev, "slice-%d: alloced only %d small bufs\n", |
@@ -2031,6 +2035,8 @@ abort_with_rx_big_ring: | |||
2031 | } | 2035 | } |
2032 | 2036 | ||
2033 | abort_with_rx_small_ring: | 2037 | abort_with_rx_small_ring: |
2038 | if (mgp->small_bytes == 0) | ||
2039 | ss->rx_small.fill_cnt = ss->rx_small.cnt; | ||
2034 | for (i = ss->rx_small.cnt; i < ss->rx_small.fill_cnt; i++) { | 2040 | for (i = ss->rx_small.cnt; i < ss->rx_small.fill_cnt; i++) { |
2035 | int idx = i & ss->rx_small.mask; | 2041 | int idx = i & ss->rx_small.mask; |
2036 | myri10ge_unmap_rx_page(mgp->pdev, &ss->rx_small.info[idx], | 2042 | myri10ge_unmap_rx_page(mgp->pdev, &ss->rx_small.info[idx], |
@@ -2081,6 +2087,8 @@ static void myri10ge_free_rings(struct myri10ge_slice_state *ss) | |||
2081 | put_page(ss->rx_big.info[idx].page); | 2087 | put_page(ss->rx_big.info[idx].page); |
2082 | } | 2088 | } |
2083 | 2089 | ||
2090 | if (mgp->small_bytes == 0) | ||
2091 | ss->rx_small.fill_cnt = ss->rx_small.cnt; | ||
2084 | for (i = ss->rx_small.cnt; i < ss->rx_small.fill_cnt; i++) { | 2092 | for (i = ss->rx_small.cnt; i < ss->rx_small.fill_cnt; i++) { |
2085 | idx = i & ss->rx_small.mask; | 2093 | idx = i & ss->rx_small.mask; |
2086 | if (i == ss->rx_small.fill_cnt - 1) | 2094 | if (i == ss->rx_small.fill_cnt - 1) |
@@ -2418,7 +2426,7 @@ static int myri10ge_open(struct net_device *dev) | |||
2418 | mgp->small_bytes = VLAN_ETH_FRAME_LEN; | 2426 | mgp->small_bytes = VLAN_ETH_FRAME_LEN; |
2419 | 2427 | ||
2420 | /* Override the small buffer size? */ | 2428 | /* Override the small buffer size? */ |
2421 | if (myri10ge_small_bytes > 0) | 2429 | if (myri10ge_small_bytes >= 0) |
2422 | mgp->small_bytes = myri10ge_small_bytes; | 2430 | mgp->small_bytes = myri10ge_small_bytes; |
2423 | 2431 | ||
2424 | /* Firmware needs the big buff size as a power of 2. Lie and | 2432 | /* Firmware needs the big buff size as a power of 2. Lie and |