From: Jan Dakinevich <jan.dakinev...@virtuozzo.com>

These structures are not disigned for DMA'ing and don't require
physically contiguous memory.

https://jira.sw.ru/browse/HCI-140

Signed-off-by: Jan Dakinevich <jan.dakinev...@virtuozzo.com>
Acked-by: Denis V. Lunev <d...@openvz.org>

(cherry-picked from vz7 commit 66e75bd04dab ("bnx2: use kvzalloc() to allocate
certain internal data"))

Signed-off-by: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com>

(cherry picked from vz8 commit 76882e5a79ae23ea03567ee3a9141e55224f40b9)
Signed-off-by: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 11 +++++------
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h |  2 +-
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c 
b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index b5d954c..ccb15f8 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -4568,9 +4568,8 @@ static int bnx2x_alloc_fp_mem_at(struct bnx2x *bp, int 
index)
                           "allocating tx memory of fp %d cos %d\n",
                           index, cos);
 
-                       txdata->tx_buf_ring = kcalloc(NUM_TX_BD,
-                                                     sizeof(struct sw_tx_bd),
-                                                     GFP_KERNEL);
+                       txdata->tx_buf_ring = kvzalloc(sizeof(struct sw_tx_bd) 
* NUM_TX_BD,
+                                                      GFP_KERNEL);
                        if (!txdata->tx_buf_ring)
                                goto alloc_mem_err;
                        txdata->tx_desc_ring = 
BNX2X_PCI_ALLOC(&txdata->tx_desc_mapping,
@@ -4584,7 +4583,7 @@ static int bnx2x_alloc_fp_mem_at(struct bnx2x *bp, int 
index)
        if (!skip_rx_queue(bp, index)) {
                /* fastpath rx rings: rx_buf rx_desc rx_comp */
                bnx2x_fp(bp, index, rx_buf_ring) =
-                       kcalloc(NUM_RX_BD, sizeof(struct sw_rx_bd), GFP_KERNEL);
+                       kvzalloc(sizeof(struct sw_rx_bd) * NUM_RX_BD, 
GFP_KERNEL);
                if (!bnx2x_fp(bp, index, rx_buf_ring))
                        goto alloc_mem_err;
                bnx2x_fp(bp, index, rx_desc_ring) =
@@ -4602,8 +4601,8 @@ static int bnx2x_alloc_fp_mem_at(struct bnx2x *bp, int 
index)
 
                /* SGE ring */
                bnx2x_fp(bp, index, rx_page_ring) =
-                       kcalloc(NUM_RX_SGE, sizeof(struct sw_rx_page),
-                               GFP_KERNEL);
+                       kvzalloc(sizeof(struct sw_rx_page) * NUM_RX_SGE,
+                                GFP_KERNEL);
                if (!bnx2x_fp(bp, index, rx_page_ring))
                        goto alloc_mem_err;
                bnx2x_fp(bp, index, rx_sge_ring) =
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h 
b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
index d805fea..81bc014 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
@@ -45,7 +45,7 @@
 #define BNX2X_FREE(x) \
        do { \
                if (x) { \
-                       kfree((void *)x); \
+                       kvfree((void *)x); \
                        x = NULL; \
                } \
        } while (0)
-- 
1.8.3.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to