[Devel] [PATCH RHEL COMMIT] bnx2: Use kvzalloc() to allocate certain internal data
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Sep 30 16:04:03 MSK 2021
The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after ark-5.14
------>
commit ddcaea39f7a2e819df81e9e4cdcb36f81b1b5c76
Author: Jan Dakinevich <jan.dakinevich at virtuozzo.com>
Date: Thu Sep 30 16:04:03 2021 +0300
bnx2: Use kvzalloc() to allocate certain internal data
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.dakinevich at virtuozzo.com>
Acked-by: Denis V. Lunev <den at openvz.org>
(cherry-picked from vz7 commit 66e75bd04dab ("bnx2: use kvzalloc() to allocate
certain internal data"))
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
(cherry picked from vz8 commit 76882e5a79ae23ea03567ee3a9141e55224f40b9)
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at 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 b5d954cb409a..ccb15f87eed0 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 d805feaf419f..81bc014d909b 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
@@ -45,7 +45,7 @@ extern int bnx2x_num_queues;
#define BNX2X_FREE(x) \
do { \
if (x) { \
- kfree((void *)x); \
+ kvfree((void *)x); \
x = NULL; \
} \
} while (0)
More information about the Devel
mailing list