From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=DATE_IN_FUTURE_06_12, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 416ECC76186 for ; Thu, 25 Jul 2019 03:29:35 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id CABB522AED for ; Thu, 25 Jul 2019 03:29:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CABB522AED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 080D71C24F; Thu, 25 Jul 2019 05:29:33 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 2478A1C225; Thu, 25 Jul 2019 05:29:29 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jul 2019 20:29:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,305,1559545200"; d="scan'208";a="160775843" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.110.185]) by orsmga007.jf.intel.com with ESMTP; 24 Jul 2019 20:29:27 -0700 Date: Thu, 25 Jul 2019 18:10:47 +0800 From: Ye Xiaolong To: Xiao Zhang Cc: dev@dpdk.org, qiming.yang@intel.com, qi.z.zhang@intel.com, stable@dpdk.org Message-ID: <20190725101047.GC18332@intel.com> References: <1563987361-5215-1-git-send-email-xiao.zhang@intel.com> <1564053515-38009-1-git-send-email-xiao.zhang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1564053515-38009-1-git-send-email-xiao.zhang@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [v3] net/ice: enable multi-process support 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 07/25, Xiao Zhang wrote: >Add multiple processes support for ice, secondary processes will share >memory and configuration with primary process, do not need further >initialization for secondary processes. > >Cc: stable@dpdk.org This is a new feature, it's no need to cc stable@dpdk.org. Thanks, Xiaolong > >Signed-off-by: Xiao Zhang >--- >v3 Update the title and commit message. >v2 Remove limitation for secondary processes control path configuration. >--- > drivers/net/ice/ice_ethdev.c | 12 +++++++ > drivers/net/ice/ice_ethdev.h | 2 ++ > drivers/net/ice/ice_rxtx.c | 74 ++++++++++++++++++++++++++++---------------- > 3 files changed, 62 insertions(+), 26 deletions(-) > >diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c >index 9ce730c..532f4db 100644 >--- a/drivers/net/ice/ice_ethdev.c >+++ b/drivers/net/ice/ice_ethdev.c >@@ -1408,6 +1408,15 @@ ice_dev_init(struct rte_eth_dev *dev) > dev->tx_pkt_burst = ice_xmit_pkts; > dev->tx_pkt_prepare = ice_prep_pkts; > >+ /* for secondary processes, we don't initialise any further as primary >+ * has already done this work. >+ */ >+ if (rte_eal_process_type() != RTE_PROC_PRIMARY) { >+ ice_set_rx_function(dev); >+ ice_set_tx_function(dev); >+ return 0; >+ } >+ > ice_set_default_ptype_table(dev); > pci_dev = RTE_DEV_TO_PCI(dev->device); > intr_handle = &pci_dev->intr_handle; >@@ -1638,6 +1647,9 @@ ice_dev_uninit(struct rte_eth_dev *dev) > struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); > struct rte_flow *p_flow; > >+ if (rte_eal_process_type() != RTE_PROC_PRIMARY) >+ return 0; >+ > ice_dev_close(dev); > > dev->dev_ops = NULL; >diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h >index 8a52239..a083616 100644 >--- a/drivers/net/ice/ice_ethdev.h >+++ b/drivers/net/ice/ice_ethdev.h >@@ -282,6 +282,8 @@ struct ice_adapter { > struct rte_eth_dev *eth_dev; > struct ice_pf pf; > bool rx_bulk_alloc_allowed; >+ bool rx_vec_allowed; >+ bool tx_vec_allowed; > bool tx_simple_allowed; > /* ptype mapping table */ > uint32_t ptype_tbl[ICE_MAX_PKT_TYPE] __rte_cache_min_aligned; >diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c >index 035ed84..d67de8f 100644 >--- a/drivers/net/ice/ice_rxtx.c >+++ b/drivers/net/ice/ice_rxtx.c >@@ -2332,35 +2332,46 @@ ice_set_rx_function(struct rte_eth_dev *dev) > int i; > bool use_avx2 = false; > >- if (!ice_rx_vec_dev_check(dev)) { >- for (i = 0; i < dev->data->nb_rx_queues; i++) { >- rxq = dev->data->rx_queues[i]; >- (void)ice_rxq_vec_setup(rxq); >- } >+ if (rte_eal_process_type() == RTE_PROC_PRIMARY) { >+ if (!ice_rx_vec_dev_check(dev) && ad->rx_bulk_alloc_allowed) { >+ ad->rx_vec_allowed = true; >+ for (i = 0; i < dev->data->nb_rx_queues; i++) { >+ rxq = dev->data->rx_queues[i]; >+ if (rxq && ice_rxq_vec_setup(rxq)) { >+ ad->rx_vec_allowed = false; >+ break; >+ } >+ } >+ >+ if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1 || >+ rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1) >+ use_avx2 = true; > >- if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1 || >- rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1) >- use_avx2 = true; >+ } else { >+ ad->rx_vec_allowed = false; >+ } >+ } > >+ if (ad->rx_vec_allowed) { > if (dev->data->scattered_rx) { > PMD_DRV_LOG(DEBUG, >- "Using %sVector Scattered Rx (port %d).", >- use_avx2 ? "avx2 " : "", >- dev->data->port_id); >+ "Using %sVector Scattered Rx (port %d).", >+ use_avx2 ? "avx2 " : "", >+ dev->data->port_id); > dev->rx_pkt_burst = use_avx2 ? >- ice_recv_scattered_pkts_vec_avx2 : >- ice_recv_scattered_pkts_vec; >+ ice_recv_scattered_pkts_vec_avx2 : >+ ice_recv_scattered_pkts_vec; > } else { > PMD_DRV_LOG(DEBUG, "Using %sVector Rx (port %d).", >- use_avx2 ? "avx2 " : "", >- dev->data->port_id); >+ use_avx2 ? "avx2 " : "", >+ dev->data->port_id); > dev->rx_pkt_burst = use_avx2 ? >- ice_recv_pkts_vec_avx2 : >- ice_recv_pkts_vec; >+ ice_recv_pkts_vec_avx2 : >+ ice_recv_pkts_vec; > } >- > return; > } >+ > #endif > > if (dev->data->scattered_rx) { >@@ -2464,16 +2475,27 @@ ice_set_tx_function(struct rte_eth_dev *dev) > int i; > bool use_avx2 = false; > >- if (!ice_tx_vec_dev_check(dev)) { >- for (i = 0; i < dev->data->nb_tx_queues; i++) { >- txq = dev->data->tx_queues[i]; >- (void)ice_txq_vec_setup(txq); >- } >+ if (rte_eal_process_type() == RTE_PROC_PRIMARY) { >+ if (!ice_tx_vec_dev_check(dev)) { >+ ad->tx_vec_allowed = true; >+ for (i = 0; i < dev->data->nb_tx_queues; i++) { >+ txq = dev->data->tx_queues[i]; >+ if (txq && ice_txq_vec_setup(txq)) { >+ ad->tx_vec_allowed = false; >+ break; >+ } >+ } > >- if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1 || >- rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1) >- use_avx2 = true; >+ if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1 || >+ rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1) >+ use_avx2 = true; >+ >+ } else { >+ ad->tx_vec_allowed = false; >+ } >+ } > >+ if (ad->tx_vec_allowed) { > PMD_DRV_LOG(DEBUG, "Using %sVector Tx (port %d).", > use_avx2 ? "avx2 " : "", > dev->data->port_id); >-- >2.7.4 >