From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by dpdk.org (Postfix) with ESMTP id 40C448E8C for ; Mon, 31 Aug 2015 08:29:15 +0200 (CEST) Received: by pabzx8 with SMTP id zx8so128775277pab.1 for ; Sun, 30 Aug 2015 23:29:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=Dbzm3YSI6uFo0KjKnI24ldNyWf5oI32TAjCRZcpI2ns=; b=T38e8qnvH1RKtiWU9l29hiuHpRwHffgUEMCMosllclqPAlTsUh0YdSQYgltqu2T7mj MQALjiDJ9csdcE2l+bMaUbdvQlfccieTJ0elPwG+0ywSHWHzkAYPQukXWa2p2EhNEA13 atGxP3LZHSB8AhtCzcxo64SQYyWIb2WWHQioK7wRQdFSeJ3yzX8ug1WWZDGrEiUxRqui /khifLJpW9sKXy7qXL83LS5gxL4/51iV0BgJTPjPUiQWiOVJeLt+k1YITfmc6rwU8r3v xCV+nFKTFpsxXCiA85qPH4SeddNtvX787VSYW7WG1NZK+kka3viWa1+Pm2c3m1JMq5lZ /JvA== X-Gm-Message-State: ALoCoQmBdPBKzj9Ou37wIVydcR35fnwAOgJEQJd+JRS40jHHcXhXWbrlA67NzjUZo3sCbZtw5NvO X-Received: by 10.68.95.225 with SMTP id dn1mr34369236pbb.128.1441002554433; Sun, 30 Aug 2015 23:29:14 -0700 (PDT) Received: from [10.16.129.101] (napt.igel.co.jp. [219.106.231.132]) by smtp.googlemail.com with ESMTPSA id m2sm13208432pdr.64.2015.08.30.23.29.12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Aug 2015 23:29:13 -0700 (PDT) Message-ID: <55E3F438.7050103@igel.co.jp> Date: Mon, 31 Aug 2015 15:29:12 +0900 From: Tetsuya Mukawa User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: "Ouyang, Changchun" , "dev@dpdk.org" References: <1440732101-18704-1-git-send-email-mukawa@igel.co.jp> <1440732101-18704-2-git-send-email-mukawa@igel.co.jp> In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: "ann.zhuangyanying@huawei.com" , "Liu, Yuanhan" Subject: Re: [dpdk-dev] [RFC PATCH] vhost: Add 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: Mon, 31 Aug 2015 06:29:15 -0000 On 2015/08/31 14:14, Ouyang, Changchun wrote: > > +struct pmd_internal { > + TAILQ_ENTRY(pmd_internal) next; > + char *dev_name; > + char *iface_name; > + unsigned nb_rx_queues; > + unsigned nb_tx_queues; > + rte_atomic16_t xfer; > + > + struct vhost_queue > rx_vhost_queues[RTE_PMD_RING_MAX_RX_RINGS]; > + struct vhost_queue > tx_vhost_queues[RTE_PMD_RING_MAX_TX_RINGS]; > +}; > Need consider how the vhost multiple queues implements here. > You can refer to the patch set I sent before. Hi Ouyang, I appreciate your comments. I will refer to your patch and fix it. >> + >> +TAILQ_HEAD(pmd_internal_head, pmd_internal); static struct >> +pmd_internal_head internals_list = >> + TAILQ_HEAD_INITIALIZER(internals_list); >> + >> +static pthread_mutex_t internal_list_lock = PTHREAD_MUTEX_INITIALIZER; >> + >> +static struct rte_eth_link pmd_link = { >> + .link_speed = 10000, >> + .link_duplex = ETH_LINK_FULL_DUPLEX, >> + .link_status = 0 >> +}; >> + >> +static uint16_t >> +eth_vhost_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) { >> + struct vhost_queue *r = q; >> + uint16_t nb_rx; >> + >> + if (unlikely(r->internal == NULL)) >> + return 0; >> + >> + if (unlikely(rte_atomic16_read(&r->internal->xfer) == 0)) >> + return 0; >> + >> + rte_atomic16_set(&r->rx_executing, 1); >> + >> + if (unlikely(rte_atomic16_read(&r->internal->xfer) == 0)) >> + goto out; >> + >> + nb_rx = (uint16_t)rte_vhost_dequeue_burst(r->device, >> + VIRTIO_TXQ, r->mb_pool, bufs, nb_bufs); > Logically correct here, > But it would be better to have more clear description why need use VIRTIO_TXQ for vhost_rx function. > It increases readability. :-) Sure, I will add comments here, also TX function. > > +static void *vhost_driver_session(void *param __rte_unused) { > + static struct virtio_net_device_ops *vhost_ops = NULL; > + vhost_ops = rte_zmalloc(NULL, sizeof(*vhost_ops), 0); > + if (vhost_ops == NULL) > + rte_panic("Can't allocate memory\n"); > + > + /* set vhost arguments */ > + vhost_ops->new_device = new_device; > + vhost_ops->destroy_device = destroy_device; > + if (rte_vhost_driver_callback_register(vhost_ops) < 0) > + rte_panic("Can't register callbacks\n"); > + > + /* start event handling */ > + rte_vhost_driver_session_start(); > It should be called after rte_vhost_driver_register, > But rte_vhost_driver_session_start is called when dev_init, > Error here? In the case of vhost-cuse, it seems we should call register() before calling start(). Thanks for your checking. I will fix it in next patch. Regards, Tetsuya