From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: [PATCH v2 0/7] virtio 1.0 enabling for virtio pmd driver Date: Thu, 14 Jan 2016 14:45:00 +0800 Message-ID: <20160114064500.GK19531@yliu-dev.sh.intel.com> References: <1449719650-3482-1-git-send-email-yuanhan.liu@linux.intel.com> <1452581944-24838-1-git-send-email-yuanhan.liu@linux.intel.com> <569723B9.5080904@igel.co.jp> <56973B8E.6010808@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org, "Michael S. Tsirkin" To: "Tan, Jianfeng" Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id D601E8DAF for ; Thu, 14 Jan 2016 07:43:44 +0100 (CET) Content-Disposition: inline In-Reply-To: <56973B8E.6010808@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Jan 14, 2016 at 02:09:18PM +0800, Tan, Jianfeng wrote: ... > I basically agree with you. We have two dimensions here: > > legacy modern > physical virtio device: Use virtio_read_caps_phys() to > distinguish > virtual virtio device (Tetsuya): Use virtio_read_caps_virt() to > distinguish > virtual virtio device (Jianfeng): does not need a "configuration space > layout", no need to distinguish I guess you meant to build a form or something, but seems you failed :) > > So in vtpci_init(), we needs to test "eth_dev->dev_type" firstly > > vtpci_init() { > if (eth_dev->dev_type == RTE_ETH_DEV_PCI) { > if (virtio_read_caps_phys()) { > // modern > } else { > // legacy > } > } else { > if (Tetsuya's way) { > if (virtio_read_caps_virt()) { > // modern > } else { > // legacy > } > } else { > // Jianfeng's way > } > } > } Normally, I'd like to hide the details inside virtio_read_caps(): I don't want similar codes to be appeared twice. And if it can be simply done by "if (eth_dev->dev_type == ...)", I'd like to do it in this way. If not, introducing another set of operation abstractions as suggested in my another email might be a better option. > And from Yuanhan's angle, I think he does not need to address this problem. Yep; it just has nothing to do with this patch set. --yliu