From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH v3 1/2] net/pcap: move pcap handler to process private Date: Wed, 14 Nov 2018 23:05:19 +0000 Message-ID: <7b2420de-b72e-422a-86e7-7a54ea50f543@intel.com> References: <20181105210823.38757-1-qi.z.zhang@intel.com> <20181114195647.196648-1-qi.z.zhang@intel.com> <20181114195647.196648-2-qi.z.zhang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: thomas@monjalon.net, dev@dpdk.org, xueqin.lin@intel.com To: Qi Zhang Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 1BCA191 for ; Thu, 15 Nov 2018 00:05:26 +0100 (CET) In-Reply-To: <20181114195647.196648-2-qi.z.zhang@intel.com> Content-Language: en-US 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 11/14/2018 7:56 PM, Qi Zhang wrote: > This is prework for data path enabling for secondary process. > To prevent pcap handler opened by one process be overwritten by > another process, each process should have their private copy, > `rte_eth_dev->process_private` is exactly what we needed. > > Signed-off-by: Qi Zhang <...> > @@ -646,8 +652,10 @@ eth_rx_queue_setup(struct rte_eth_dev *dev, > struct rte_mempool *mb_pool) > { > struct pmd_internals *internals = dev->data->dev_private; > + struct pmd_process_private *pp = dev->process_private; > struct pcap_rx_queue *pcap_q = &internals->rx_queue[rx_queue_id]; > > + pcap_q->pcap = pp->rx_pcap[rx_queue_id]; > pcap_q->mb_pool = mb_pool; > dev->data->rx_queues[rx_queue_id] = pcap_q; > pcap_q->in_port = dev->data->port_id; > @@ -663,8 +671,12 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, > const struct rte_eth_txconf *tx_conf __rte_unused) > { > struct pmd_internals *internals = dev->data->dev_private; > + struct pmd_process_private *pp = dev->process_private; > + struct pcap_tx_queue *pcap_q = &internals->tx_queue[tx_queue_id]; > > - dev->data->tx_queues[tx_queue_id] = &internals->tx_queue[tx_queue_id]; > + pcap_q->pcap = pp->tx_pcap[tx_queue_id]; > + pcap_q->dumper = pp->tx_dumper[tx_queue_id]; > + dev->data->tx_queues[tx_queue_id] = pcap_q; We can't do this, this will be same thing as not using process_private at all, dev->data is shared between primary and secondary. Handlers need to be accessed directly from process_private in burst functions. To able to match queue with handlers in process_private, queue may need to include queue_index. tap pmd has similar implementation already.