From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpbgau1.qq.com (smtpbgau1.qq.com [54.206.16.166]) by dpdk.org (Postfix) with ESMTP id B19E8F8AA for ; Thu, 5 Jan 2017 13:02:09 +0100 (CET) X-QQ-mid: bizesmtp5t1483617725teuwx9odn Received: from local.opencloud.tech.localdomai (unknown [106.120.127.11]) by esmtp4.qq.com (ESMTP) with id ; Thu, 05 Jan 2017 20:02:04 +0800 (CST) X-QQ-SSF: 0110000000200070F650000A0000000 X-QQ-FEAT: uUcGM8V09o6b2+q8sUxj36g2TauiDB9CaWA1J13aLtPOWvR/66YhSoOZRrK7B XtVxdfPx0HPS+fe5/GFNidu4wIweE6nHLrENSwcDN82TSQxW7DGXVE/+C/5GORE5ZF02bDO 0P8vuFiCn9Xoqi59kwLy++h1LQTGAyl1DfboTl2XQqiQom70mQg0b1pq3mTs70vxz8lHrdY 4tP2S0o5AII4Y+7KiPiljxTnmSpE2hEhghr34ViGb03RZfkP8y/+MZAjO5RgVFsSTj66ZmU s/VTMXhOdh8nzE X-QQ-GoodBg: 0 From: nickcooper-zhangtonghao To: dev@dpdk.org Cc: nickcooper-zhangtonghao Date: Thu, 5 Jan 2017 04:01:49 -0800 Message-Id: <1483617709-7088-5-git-send-email-nic@opencloud.tech> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1483617709-7088-1-git-send-email-nic@opencloud.tech> References: <1483617709-7088-1-git-send-email-nic@opencloud.tech> X-QQ-SENDSIZE: 520 X-QQ-Bgrelay: 1 Subject: [dpdk-dev] [PATCH v2 5/5] vmxnet3: Avoid segfault caused by vmxnet3_dev_tx_queue_setup. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2017 12:02:11 -0000 We should allocate Tx ring for max possible mumber of hardware descriptors. If we config Tx queue with 2048 Tx queue size, and 4096 soon, there will be segment fault. Signed-off-by: nickcooper-zhangtonghao --- drivers/net/vmxnet3/vmxnet3_rxtx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index f00b3b9..5f35a2e 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -874,9 +874,10 @@ comp_ring->next2proc = 0; comp_ring->gen = VMXNET3_INIT_GEN; - size = sizeof(struct Vmxnet3_TxDesc) * ring->size; - size += sizeof(struct Vmxnet3_TxCompDesc) * comp_ring->size; - size += sizeof(struct Vmxnet3_TxDataDesc) * data_ring->size; + /* Allocate Tx ring for max possible number of hardware descriptors. */ + size = sizeof(struct Vmxnet3_TxDesc) * VMXNET3_TX_RING_MAX_SIZE; + size += sizeof(struct Vmxnet3_TxCompDesc) * VMXNET3_TX_RING_MAX_SIZE; + size += sizeof(struct Vmxnet3_TxDataDesc) * VMXNET3_TX_RING_MAX_SIZE; mz = ring_dma_zone_reserve(dev, "txdesc", queue_idx, size, socket_id); if (mz == NULL) { -- 1.8.3.1