From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id A386723B for ; Mon, 22 May 2017 08:35:23 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP; 21 May 2017 23:35:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,377,1491289200"; d="scan'208";a="859834018" Received: from dpdk-wangxiao.sh.intel.com ([10.239.129.106]) by FMSMGA003.fm.intel.com with ESMTP; 21 May 2017 23:35:20 -0700 From: Xiao Wang To: stable@dpdk.org Cc: yuanhan.liu@linux.intel.com, Xiao Wang Date: Mon, 22 May 2017 08:22:30 -0700 Message-Id: <1495466550-64354-1-git-send-email-xiao.w.wang@intel.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-stable] [PATCH] net/fm10k: fix secondary process crash X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 May 2017 06:35:24 -0000 [ backported from upstream commit 88e4ed70b3a0b279383ddac43ef231ec518d6b4d ] If the primary process has initialized all the queues to vector pmd mode, the secondary process should not use scalar code path, because the per queue data structures haven't been prepared for that, e.g. txq->ops is for vector Tx rather than scalar Tx. Fixes: a6ce64a97520 ("fm10k: introduce vector driver") Signed-off-by: Xiao Wang Acked-by: Jing Chen --- drivers/net/fm10k/fm10k_ethdev.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index cd051ae..a4eefe3 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -2738,6 +2738,19 @@ static void __attribute__((cold)) int use_sse = 1; uint16_t tx_ftag_en = 0; + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { + /* primary process has set the ftag flag and txq_flags */ + txq = dev->data->tx_queues[0]; + if (fm10k_tx_vec_condition_check(txq)) { + dev->tx_pkt_burst = fm10k_xmit_pkts; + PMD_INIT_LOG(DEBUG, "Use regular Tx func"); + } else { + PMD_INIT_LOG(DEBUG, "Use vector Tx func"); + dev->tx_pkt_burst = fm10k_xmit_pkts_vec; + } + return; + } + if (fm10k_check_ftag(dev->pci_dev->device.devargs)) tx_ftag_en = 1; @@ -2796,6 +2809,9 @@ static void __attribute__((cold)) else PMD_INIT_LOG(DEBUG, "Use regular Rx func"); + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return; + for (i = 0; i < dev->data->nb_rx_queues; i++) { struct fm10k_rx_queue *rxq = dev->data->rx_queues[i]; @@ -2839,9 +2855,15 @@ static void __attribute__((cold)) dev->rx_pkt_burst = &fm10k_recv_pkts; dev->tx_pkt_burst = &fm10k_xmit_pkts; - /* only initialize in the primary process */ - if (rte_eal_process_type() != RTE_PROC_PRIMARY) + /* + * Primary process does the whole initialization, for secondary + * processes, we just select the same Rx and Tx function as primary. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { + fm10k_set_rx_function(dev); + fm10k_set_tx_function(dev); return 0; + } rte_eth_copy_pci_info(dev, dev->pci_dev); -- 1.8.3.1