提交 26d92f92 编写于 作者: S Sathya Perla 提交者: David S. Miller

be2net: fix bug in rx page posting

Pages are posted to the rxq in such a way that more than one frag
can share the page. The last frag that uses the page unmaps the
page.  In the case when a page is not fully used (due to lack of space in rxq)
the last frag that uses the page is not being set as a "last_page_user";
instead, the next frag in the rxq is incorrectly being set.

The fix has also been tested on ppc64 with 64k pages...
Signed-off-by: NSathya Perla <sathyap@serverengines.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 b94b5028
...@@ -910,7 +910,7 @@ static inline struct page *be_alloc_pages(u32 size) ...@@ -910,7 +910,7 @@ static inline struct page *be_alloc_pages(u32 size)
static void be_post_rx_frags(struct be_adapter *adapter) static void be_post_rx_frags(struct be_adapter *adapter)
{ {
struct be_rx_page_info *page_info_tbl = adapter->rx_obj.page_info_tbl; struct be_rx_page_info *page_info_tbl = adapter->rx_obj.page_info_tbl;
struct be_rx_page_info *page_info = NULL; struct be_rx_page_info *page_info = NULL, *prev_page_info = NULL;
struct be_queue_info *rxq = &adapter->rx_obj.q; struct be_queue_info *rxq = &adapter->rx_obj.q;
struct page *pagep = NULL; struct page *pagep = NULL;
struct be_eth_rx_d *rxd; struct be_eth_rx_d *rxd;
...@@ -941,7 +941,6 @@ static void be_post_rx_frags(struct be_adapter *adapter) ...@@ -941,7 +941,6 @@ static void be_post_rx_frags(struct be_adapter *adapter)
rxd = queue_head_node(rxq); rxd = queue_head_node(rxq);
rxd->fragpa_lo = cpu_to_le32(frag_dmaaddr & 0xFFFFFFFF); rxd->fragpa_lo = cpu_to_le32(frag_dmaaddr & 0xFFFFFFFF);
rxd->fragpa_hi = cpu_to_le32(upper_32_bits(frag_dmaaddr)); rxd->fragpa_hi = cpu_to_le32(upper_32_bits(frag_dmaaddr));
queue_head_inc(rxq);
/* Any space left in the current big page for another frag? */ /* Any space left in the current big page for another frag? */
if ((page_offset + rx_frag_size + rx_frag_size) > if ((page_offset + rx_frag_size + rx_frag_size) >
...@@ -949,10 +948,13 @@ static void be_post_rx_frags(struct be_adapter *adapter) ...@@ -949,10 +948,13 @@ static void be_post_rx_frags(struct be_adapter *adapter)
pagep = NULL; pagep = NULL;
page_info->last_page_user = true; page_info->last_page_user = true;
} }
prev_page_info = page_info;
queue_head_inc(rxq);
page_info = &page_info_tbl[rxq->head]; page_info = &page_info_tbl[rxq->head];
} }
if (pagep) if (pagep)
page_info->last_page_user = true; prev_page_info->last_page_user = true;
if (posted) { if (posted) {
atomic_add(posted, &rxq->used); atomic_add(posted, &rxq->used);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册