diff options
author | Pavel Belous <pavel.belous@aquantia.com> | 2017-02-20 20:36:49 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-02-20 23:11:09 +0100 |
commit | 89b643889b1f56d8b53728f6153a4237c849784b (patch) | |
tree | efffc29967430abdc24b37111ed78b3b491e3f90 /drivers/net/ethernet/aquantia/atlantic | |
parent | net: ethernet: aquantia: Fixed incorrect buff->len calculation. (diff) | |
download | linux-89b643889b1f56d8b53728f6153a4237c849784b.tar.xz linux-89b643889b1f56d8b53728f6153a4237c849784b.zip |
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: Pavel Belous <pavel.belous@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/aquantia/atlantic')
-rw-r--r-- | drivers/net/ethernet/aquantia/atlantic/aq_ring.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c index 22bb75eff274..51f4e7f5e132 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c @@ -270,6 +270,8 @@ err_exit: 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; int err = 0; int i = 0; @@ -282,7 +284,7 @@ int aq_ring_rx_fill(struct aq_ring_s *self) buff->len = AQ_CFG_RX_FRAME_MAX; buff->page = alloc_pages(GFP_ATOMIC | __GFP_COLD | - __GFP_COMP, 0); + __GFP_COMP, pages_order); if (!buff->page) { err = -ENOMEM; goto err_exit; |