From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f177.google.com (mail-pf0-f177.google.com [209.85.192.177]) by dpdk.org (Postfix) with ESMTP id 6F7CA5A57 for ; Thu, 24 Dec 2015 05:23:52 +0100 (CET) Received: by mail-pf0-f177.google.com with SMTP id 65so17995406pff.3 for ; Wed, 23 Dec 2015 20:23:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=H6PvGnpu+RUYnLZ2Zll4wGRsTwCUw7L4ILbaSG4x8KE=; b=KmA7aPr/VR6Gzz7vdWAmXPiAe2sEGi74tSzpZsybHNxEKF+wKYvTb7EcR9dvr9GMFL E9qOTowfNtOO/Omxe9o2tNqTCLQDQccdmwqFv1szjkOx2DdNZbvy58ag8oosZzSS2yiH s+is6ft4UgY1JgAKHxqGKnwQwqJQZpCoVfKLMlC2pNCczJOrWN+8RQEF7sVKAtc9vrs0 WIoz35EQJHpeNhUKzjQEZQ8OxGnIaVu/X9DJ/rRkIIM/wWZyPOxQe58xX3Uea4eXhNnr NKLPsH4w1aqpS+PAvaCtv1/NRD4PxZfJB2S9ZRc/B6H66GTMHF2O3u2gKS/gG2V6gzoT 4p0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=H6PvGnpu+RUYnLZ2Zll4wGRsTwCUw7L4ILbaSG4x8KE=; b=kY/RcYWFAG9xzNfggWjE5PTc6Lo8thGJzMVtPyVUxcfxIdEZAmsxkY6NIWZNbZ+CuC TC0+jpn8lOmArFd8KHXgwj+PVu3vNzay1QtUJnsT1VSYZwR3VaPBkX2dMJYhB6rv2rQj s8hcp1af4SIuzIpKxkEbYjK8DNgSeejujdynQ+dHd82+M2V6kZKqJBGjh7+WWCxhPNF1 D8rhJNNGOaJnHpLvJtl8eXr+DFDS9NG2O3zp8+Yff7JU4uMIM5pCBhH9HWMSGJIKwQMk XLBuFkfbadDnbcHA6SRgswRil/OE5Pb2RTHTOiElBLDpIJFLiemwTNKzcRAR8zgi37kp 5Sjw== X-Gm-Message-State: ALoCoQmwKG9DbEv2KKJrP3gCSikRKLsCdJs748U6hd+GQDDl9SCu/OdmfSiyGhGMX+a9BZynXPlTf29O6cTyrixqQD1vgNyuvg== X-Received: by 10.98.15.150 with SMTP id 22mr48997533pfp.57.1450931031704; Wed, 23 Dec 2015 20:23:51 -0800 (PST) Received: from [10.16.129.101] (napt.igel.co.jp. [219.106.231.132]) by smtp.googlemail.com with ESMTPSA id xi8sm55708793pab.9.2015.12.23.20.23.50 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 23 Dec 2015 20:23:51 -0800 (PST) To: Yuanhan Liu References: <1448355603-21275-1-git-send-email-mukawa@igel.co.jp> <1448355603-21275-2-git-send-email-mukawa@igel.co.jp> <20151217114223.GC29571@yliu-dev.sh.intel.com> <56737A5E.1030803@igel.co.jp> <20151218041536.GI29571@yliu-dev.sh.intel.com> <56738B5C.1030206@igel.co.jp> <20151222034158.GH18863@yliu-dev.sh.intel.com> <567B61D6.1090806@igel.co.jp> <20151224040030.GB18863@yliu-dev.sh.intel.com> From: Tetsuya Mukawa X-Enigmail-Draft-Status: N1110 Message-ID: <567B7357.3040404@igel.co.jp> Date: Thu, 24 Dec 2015 13:23:51 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <20151224040030.GB18863@yliu-dev.sh.intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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, 24 Dec 2015 04:23:52 -0000 On 2015/12/24 13:00, Yuanhan Liu wrote: > On Thu, Dec 24, 2015 at 12:09:10PM +0900, Tetsuya Mukawa wrote: >> On 2015/12/22 13:47, Rich Lane wrote: >>> On Mon, Dec 21, 2015 at 7:41 PM, Yuanhan Liu >>> wrote: >>> >>>> On Fri, Dec 18, 2015 at 10:01:25AM -0800, Rich Lane wrote: >>>>> I'm using the vhost callbacks and struct virtio_net with the vhost PMD >>>> in a few >>>>> ways: >>>> Rich, thanks for the info! >>>> >>>>> 1. new_device/destroy_device: Link state change (will be covered by the >>>> link >>>>> status interrupt). >>>>> 2. new_device: Add first queue to datapath. >>>> I'm wondering why vring_state_changed() is not used, as it will also be >>>> triggered at the beginning, when the default queue (the first queue) is >>>> enabled. >>>> >>> Turns out I'd misread the code and it's already using the >>> vring_state_changed callback for the >>> first queue. Not sure if this is intentional but vring_state_changed is >>> called for the first queue >>> before new_device. >>> >>> >>>>> 3. vring_state_changed: Add/remove queue to datapath. >>>>> 4. destroy_device: Remove all queues (vring_state_changed is not called >>>> when >>>>> qemu is killed). >>>> I had a plan to invoke vring_state_changed() to disable all vrings >>>> when destroy_device() is called. >>>> >>> That would be good. >>> >>> >>>>> 5. new_device and struct virtio_net: Determine NUMA node of the VM. >>>> You can get the 'struct virtio_net' dev from all above callbacks. >>> >>>> 1. Link status interrupt. >>>> >>>> To vhost pmd, new_device()/destroy_device() equals to the link status >>>> interrupt, where new_device() is a link up, and destroy_device() is link >>>> down(). >>>> >>>> >>>>> 2. New queue_state_changed callback. Unlike vring_state_changed this >>>> should >>>>> cover the first queue at new_device and removal of all queues at >>>>> destroy_device. >>>> As stated above, vring_state_changed() should be able to do that, except >>>> the one on destroy_device(), which is not done yet. >>>> >>>>> 3. Per-queue or per-device NUMA node info. >>>> You can query the NUMA node info implicitly by get_mempolicy(); check >>>> numa_realloc() at lib/librte_vhost/virtio-net.c for reference. >>>> >>> Your suggestions are exactly how my application is already working. I was >>> commenting on the >>> proposed changes to the vhost PMD API. I would prefer to >>> use RTE_ETH_EVENT_INTR_LSC >>> and rte_eth_dev_socket_id for consistency with other NIC drivers, instead >>> of these vhost-specific >>> hacks. The queue state change callback is the one new API that needs to be >>> added because >>> normal NICs don't have this behavior. >>> >>> You could add another rte_eth_event_type for the queue state change >>> callback, and pass the >>> queue ID, RX/TX direction, and enable bit through cb_arg. >> Hi Rich, >> >> So far, EAL provides rte_eth_dev_callback_register() for event handling. >> DPDK app can register callback handler and "callback argument". >> And EAL will call callback handler with the argument. >> Anyway, vhost library and PMD cannot change the argument. > Yes, the event callback argument is provided from application, where it > has no way to know info you mentioned above, like queue ID, RX/TX direction. > > For that, we may need introduce another structure to note all above > info, and embed it to virtio_net struct. > >> I guess the callback handler will need to call ethdev APIs to know what >> causes the interrupt. >> Probably rte_eth_dev_socket_id() is to know numa_node, and >> rte_eth_dev_info_get() is to know the number of queues. >> Is this okay for your case? > I don't think that's enough, and I think Rich has already given all info > needed to a queue change interrupt to you. (That would also answer your > questions in another email) > > --yliu Thanks. Yes, I agree we need to provides such information through "struct virtio_net". And the callback handler needs to handle the vhost specific structure directly. Probably it's difficult to remove "struct virtio_net" from callback handler of DPDK app. This is the point I want to describe. Tetsuya,