[Devel] [PATCH 7/8] bnx2x: suppress warnings on DMA memory allocation

Andrey Zhadchenko andrey.zhadchenko at virtuozzo.com
Fri May 21 19:26:51 MSK 2021


From: Jan Dakinevich <jan.dakinevich at virtuozzo.com>

Suppress all allocator's warnings to skip checking for high page order,
and re-raise own warning if the allocation failed.

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>

Rebased to vz8:
 - dma_zalloc_coherent -> dma_alloc_coherent since it is now zeroing memory

(cherry-picked from 8c91e519af93fe48615b584c0fc45a3b85584fd9)
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
index 5ae3c97..76ff0a8 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
@@ -52,22 +52,26 @@
 
 #define BNX2X_PCI_ALLOC(y, size)					\
 ({									\
-	void *x = dma_alloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \
+	void *x = dma_alloc_coherent(&bp->pdev->dev, size, y,		\
+				      GFP_KERNEL | __GFP_NOWARN);	\
 	if (x)								\
 		DP(NETIF_MSG_HW,					\
 		   "BNX2X_PCI_ALLOC: Physical %Lx Virtual %p\n",	\
 		   (unsigned long long)(*y), x);			\
+	WARN_ON(!x);							\
 	x;								\
 })
 #define BNX2X_PCI_FALLOC(y, size)					\
 ({									\
-	void *x = dma_alloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \
+	void *x = dma_alloc_coherent(&bp->pdev->dev, size, y,		\
+				     GFP_KERNEL | __GFP_NOWARN);	\
 	if (x) {							\
 		memset(x, 0xff, size);					\
 		DP(NETIF_MSG_HW,					\
 		   "BNX2X_PCI_FALLOC: Physical %Lx Virtual %p\n",	\
 		   (unsigned long long)(*y), x);			\
 	}								\
+	WARN_ON(!x);							\
 	x;								\
 })
 
-- 
1.8.3.1



More information about the Devel mailing list