From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 0BBF168A5 for ; Thu, 17 Dec 2015 12:42:00 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP; 17 Dec 2015 03:42:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,440,1444719600"; d="scan'208";a="862877499" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.66.49]) by fmsmga001.fm.intel.com with ESMTP; 17 Dec 2015 03:41:59 -0800 Date: Thu, 17 Dec 2015 19:42:23 +0800 From: Yuanhan Liu To: Tetsuya Mukawa , "Xie, Huawei" Message-ID: <20151217114223.GC29571@yliu-dev.sh.intel.com> References: <1447392031-24970-3-git-send-email-mukawa@igel.co.jp> <1448355603-21275-1-git-send-email-mukawa@igel.co.jp> <1448355603-21275-2-git-send-email-mukawa@igel.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1448355603-21275-2-git-send-email-mukawa@igel.co.jp> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: dev@dpdk.org, ann.zhuangyanying@huawei.com Subject: Re: [dpdk-dev] [PATCH v5 1/3] vhost: Add callback and private data for vhost PMD X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Dec 2015 11:42:01 -0000 On Tue, Nov 24, 2015 at 06:00:01PM +0900, Tetsuya Mukawa wrote: > The vhost PMD will be a wrapper of vhost library, but some of vhost > library APIs cannot be mapped to ethdev library APIs. > Becasue of this, in some cases, we still need to use vhost library APIs > for a port created by the vhost PMD. > > Currently, when virtio device is created and destroyed, vhost library > will call one of callback handlers. The vhost PMD need to use this > pair of callback handlers to know which virtio devices are connected > actually. > Because we can register only one pair of callbacks to vhost library, if > the PMD use it, DPDK applications cannot have a way to know the events. > > This may break legacy DPDK applications that uses vhost library. To prevent > it, this patch adds one more pair of callbacks to vhost library especially > for the vhost PMD. > With the patch, legacy applications can use the vhost PMD even if they need > additional specific handling for virtio device creation and destruction. > > For example, legacy application can call > rte_vhost_enable_guest_notification() in callbacks to change setting. TBH, I never liked it since the beginning. Introducing two callbacks for one event is a bit messy, and therefore error prone. I have been thinking this occasionally last few weeks, and have came up something that we may introduce another layer callback based on the vhost pmd itself, by a new API: rte_eth_vhost_register_callback(). And we then call those new callback inside the vhost pmd new_device() and vhost pmd destroy_device() implementations. And we could have same callbacks like vhost have, but I'm thinking that new_device() and destroy_device() doesn't sound like a good name to a PMD driver. Maybe a name like "link_state_changed" is better? What do you think of that? On the other hand, I'm still thinking is that really necessary to let the application be able to call vhost functions like rte_vhost_enable_guest_notification() with the vhost PMD driver? --yliu