Commit 89b64388 authored by Pavel Belous's avatar Pavel Belous Committed by David S. Miller

net: ethernet: aquantia: Fixed memory allocation if AQ_CFG_RX_FRAME_MAX > 1 page.

We should allocate the number of pages based on the config parameter
AQ_CFG_RX_FRAME_MAX.
Signed-off-by: default avatarPavel Belous <pavel.belous@aquantia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c0788f74
...@@ -270,6 +270,8 @@ int aq_ring_rx_clean(struct aq_ring_s *self, int *work_done, int budget) ...@@ -270,6 +270,8 @@ int aq_ring_rx_clean(struct aq_ring_s *self, int *work_done, int budget)
int aq_ring_rx_fill(struct aq_ring_s *self) int aq_ring_rx_fill(struct aq_ring_s *self)
{ {
unsigned int pages_order = fls(AQ_CFG_RX_FRAME_MAX / PAGE_SIZE +
(AQ_CFG_RX_FRAME_MAX % PAGE_SIZE ? 1 : 0)) - 1;
struct aq_ring_buff_s *buff = NULL; struct aq_ring_buff_s *buff = NULL;
int err = 0; int err = 0;
int i = 0; int i = 0;
...@@ -282,7 +284,7 @@ int aq_ring_rx_fill(struct aq_ring_s *self) ...@@ -282,7 +284,7 @@ int aq_ring_rx_fill(struct aq_ring_s *self)
buff->len = AQ_CFG_RX_FRAME_MAX; buff->len = AQ_CFG_RX_FRAME_MAX;
buff->page = alloc_pages(GFP_ATOMIC | __GFP_COLD | buff->page = alloc_pages(GFP_ATOMIC | __GFP_COLD |
__GFP_COMP, 0); __GFP_COMP, pages_order);
if (!buff->page) { if (!buff->page) {
err = -ENOMEM; err = -ENOMEM;
goto err_exit; goto err_exit;
......
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