From: Rafal Kozik <rk@semihalf.com>
To: stable@dpdk.org
Cc: mw@semihalf.com, mk@semihalf.com, gtzalik@amazon.com,
evgenys@amazon.com, matua@amazon.com, igorch@amazon.com,
yskoh@mellanox.com, Rafal Kozik <rk@semihalf.com>
Subject: [dpdk-stable] [17.11 3/3] net/ena: change memory type
Date: Fri, 27 Jul 2018 12:39:06 +0200 [thread overview]
Message-ID: <1532687946-14276-4-git-send-email-rk@semihalf.com> (raw)
In-Reply-To: <1532687946-14276-1-git-send-email-rk@semihalf.com>
[ backported from upstream commit 9f32c7e7e6ce58ab772913f54f8328c1c0186a17 ]
ENA_MEM_ALLOC_NODE not need to use contiguous physical memory.
Also using memset without checking if allocation succeed can cause
segmentation fault.
To avoid both issue use rte_zmalloc_socket.
Fixes: 3d3edc265fc8 ("net/ena: make coherent memory allocation NUMA-aware")
Signed-off-by: Rafal Kozik <rk@semihalf.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
---
drivers/net/ena/base/ena_plat_dpdk.h | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h
index 362741a..8363fb4 100644
--- a/drivers/net/ena/base/ena_plat_dpdk.h
+++ b/drivers/net/ena/base/ena_plat_dpdk.h
@@ -224,14 +224,8 @@ typedef uint64_t dma_addr_t;
#define ENA_MEM_ALLOC_NODE(dmadev, size, virt, node, dev_node) \
do { \
- const struct rte_memzone *mz; \
- char z_name[RTE_MEMZONE_NAMESIZE]; \
ENA_TOUCH(dmadev); ENA_TOUCH(dev_node); \
- snprintf(z_name, sizeof(z_name), \
- "ena_alloc_%d", ena_alloc_cnt++); \
- mz = rte_memzone_reserve(z_name, size, node, 0); \
- memset(mz->addr, 0, size); \
- virt = mz->addr; \
+ virt = rte_zmalloc_socket(NULL, size, 0, node); \
} while (0)
#define ENA_MEM_ALLOC(dmadev, size) rte_zmalloc(NULL, size, 1)
--
2.7.4
next prev parent reply other threads:[~2018-07-27 10:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-27 10:39 [dpdk-stable] [17.11 0/3] Fixes backported to 17.11 Rafal Kozik
2018-07-27 10:39 ` [dpdk-stable] [17.11 1/3] net/ena: set link speed as none Rafal Kozik
2018-07-27 10:39 ` [dpdk-stable] [17.11 2/3] net/ena: check pointer before memset Rafal Kozik
2018-07-27 10:39 ` Rafal Kozik [this message]
2018-07-27 17:15 ` [dpdk-stable] [17.11 0/3] Fixes backported to 17.11 Yongseok Koh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1532687946-14276-4-git-send-email-rk@semihalf.com \
--to=rk@semihalf.com \
--cc=evgenys@amazon.com \
--cc=gtzalik@amazon.com \
--cc=igorch@amazon.com \
--cc=matua@amazon.com \
--cc=mk@semihalf.com \
--cc=mw@semihalf.com \
--cc=stable@dpdk.org \
--cc=yskoh@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).