From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 62F1368A9 for ; Thu, 11 May 2017 08:20:33 +0200 (CEST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 May 2017 23:20:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,322,1491289200"; d="scan'208";a="100640918" Received: from shwdeisgchi083.ccr.corp.intel.com (HELO [10.239.67.32]) ([10.239.67.32]) by fmsmga006.fm.intel.com with ESMTP; 10 May 2017 23:20:30 -0700 From: "Tan, Jianfeng" To: "dev@dpdk.org" Cc: Thomas Monjalon , "Richardson, Bruce" , "Ananyev, Konstantin" , Stephen Hemminger , Yuanhan Liu , Ferruh Yigit , "Yang, Zhiyong" , huanghuai@meituan.com Message-ID: <9ec37184-ef14-8377-d913-8ee8fda11c5e@intel.com> Date: Thu, 11 May 2017 14:20:29 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: [dpdk-dev] [RFC] Enable primary/secondary model for vdev 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, 11 May 2017 06:20:33 -0000 Hi, Status quo: Almost none of vdev supports primary/secondary model. Two exceptions are rte_ring, virtio-user (limited support). Two problems facing this issue. P1: How to attach vdev in secondary process? Previous discussion: http://dpdk.org/ml/archives/dev/2017-April/063370.html According current implementation, vdev can be recognized on vdev bus only if it is explicitly assigned in the parameters, or invokes call rte_eal_vdev_init() to create one. Assigning --vdev parameter explicitly on secondary process is not the optimal way. Instead, we can iterate rte_eth_dev_data array to discover/obtain all devices, which seems a more unified solution with PCI devices. If we only need to obtain the statistics of vdev in secondary process (like what dpdk-procinfo does), solving above issue is enough, but if we need to Rx/Tx packets in secondary process for vdev, we need to solve the following problem too. P2: How to share dev-specific FDs to secondary process? We need to share the FDs which are opened at primary process, for example, the socket file of pcap, the char device of tap, the QEMU memory region fds of vhost-user, etc. The only (as far as we know) way to share FD between processes in Linux is to use ancillary data of sendmsg/recvmsg on unix socket. That means we propose a new socket file created for each primary proess, and secondary processes will connect with this unix socket; and for simplicity, we also propose a new API to share FD, so that vdev can make use of it to share FDs. Another problem I'd like to make clear is: can secondary processes own ports that does not belong to primary? Besides, there are two errors in documents: (1) rte_ring supports primary/secondary model but the document does not state that; (2) pcap does not support primary/secondary model but the document states it supports. Thanks, Jianfeng