From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 4ADE28E58 for ; Wed, 23 Sep 2015 05:44:02 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 22 Sep 2015 20:44:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,576,1437462000"; d="scan'208";a="795281185" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.66.60]) by fmsmga001.fm.intel.com with ESMTP; 22 Sep 2015 20:44:00 -0700 Date: Wed, 23 Sep 2015 11:46:12 +0800 From: Yuanhan Liu To: Marcel Apfelbaum Message-ID: <20150923034612.GF2339@yliu-dev.sh.intel.com> References: <20150921020619.GN2339@yliu-dev.sh.intel.com> <560044CE.4040002@gmail.com> <20150922073132.GT2339@yliu-dev.sh.intel.com> <56010CE5.1030608@redhat.com> <20150922083416.GW2339@yliu-dev.sh.intel.com> <560115A5.2020602@redhat.com> <20150922092108.GX2339@yliu-dev.sh.intel.com> <56012819.2090302@redhat.com> <20150922142220.GY2339@yliu-dev.sh.intel.com> <56016AD6.3080009@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="zYM0uCDKw75PZbzx" Content-Disposition: inline In-Reply-To: <56016AD6.3080009@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: dev@dpdk.org, "Michael S. Tsirkin" Subject: Re: [dpdk-dev] [PATCH v5 resend 03/12] vhost: vring queue setup for multiple queue support 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: Wed, 23 Sep 2015 03:44:02 -0000 --zYM0uCDKw75PZbzx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Sep 22, 2015 at 05:51:02PM +0300, Marcel Apfelbaum wrote: > >It's proved to work after the fix (at least in my testing), but > >it's late here and I'm gonna send a new version tomorrow, including > >some other comments addressing. Please do more test then :) > > It's unlikely that I will send another version unless I have clear clue how to address a comment from Michael about vring flush. But anyway, you still could help me to prove the fix works. You can apply the attachment on top of my old patchset, and it should work. --yliu > > Those are very good news! > Tomorrow we have holidays but the day after that I'll try it for sure. --zYM0uCDKw75PZbzx Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=diff diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c index 33bdacd..d304ee6 100644 --- a/lib/librte_vhost/virtio-net.c +++ b/lib/librte_vhost/virtio-net.c @@ -467,6 +467,8 @@ static int set_features(struct vhost_device_ctx ctx, uint64_t *pu) { struct virtio_net *dev; + uint16_t vhost_hlen; + uint16_t i; dev = get_device(ctx); if (dev == NULL) @@ -474,27 +476,26 @@ set_features(struct vhost_device_ctx ctx, uint64_t *pu) if (*pu & ~VHOST_FEATURES) return -1; - /* Store the negotiated feature list for the device. */ dev->features = *pu; - - /* Set the vhost_hlen depending on if VIRTIO_NET_F_MRG_RXBUF is set. */ if (dev->features & (1 << VIRTIO_NET_F_MRG_RXBUF)) { LOG_DEBUG(VHOST_CONFIG, "(%"PRIu64") Mergeable RX buffers enabled\n", dev->device_fh); - dev->virtqueue[VIRTIO_RXQ]->vhost_hlen = - sizeof(struct virtio_net_hdr_mrg_rxbuf); - dev->virtqueue[VIRTIO_TXQ]->vhost_hlen = - sizeof(struct virtio_net_hdr_mrg_rxbuf); + vhost_hlen = sizeof(struct virtio_net_hdr_mrg_rxbuf); } else { LOG_DEBUG(VHOST_CONFIG, "(%"PRIu64") Mergeable RX buffers disabled\n", dev->device_fh); - dev->virtqueue[VIRTIO_RXQ]->vhost_hlen = - sizeof(struct virtio_net_hdr); - dev->virtqueue[VIRTIO_TXQ]->vhost_hlen = - sizeof(struct virtio_net_hdr); + vhost_hlen = sizeof(struct virtio_net_hdr); + } + + for (i = 0; i < dev->virt_qp_nb; i++) { + uint16_t base_idx = i * VIRTIO_QNUM; + + dev->virtqueue[base_idx + VIRTIO_RXQ]->vhost_hlen = vhost_hlen; + dev->virtqueue[base_idx + VIRTIO_TXQ]->vhost_hlen = vhost_hlen; } + return 0; } --zYM0uCDKw75PZbzx--