From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 42488A00E6 for ; Mon, 2 Sep 2019 09:10:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 10EBC1D411; Mon, 2 Sep 2019 09:10:05 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 654311C1FE; Mon, 2 Sep 2019 09:10:01 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Sep 2019 00:10:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,457,1559545200"; d="scan'208";a="357411859" Received: from dpdk-virtio-tbie-2.sh.intel.com (HELO ___) ([10.67.104.71]) by orsmga005.jf.intel.com with ESMTP; 02 Sep 2019 00:09:58 -0700 Date: Mon, 2 Sep 2019 15:07:31 +0800 From: Tiwei Bie To: Maxime Coquelin Cc: zhihong.wang@intel.com, amorenoz@redhat.com, xiao.w.wang@intel.com, dev@dpdk.org, jfreimann@redhat.com, stable@dpdk.org Message-ID: <20190902070731.GA16025@___> References: <20190829080000.20806-1-maxime.coquelin@redhat.com> <20190829080000.20806-12-maxime.coquelin@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190829080000.20806-12-maxime.coquelin@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-stable] [PATCH 11/15] net/virtio: add vDPA op to stop and close the device X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Thu, Aug 29, 2019 at 09:59:56AM +0200, Maxime Coquelin wrote: > This patch implements the vDPA .dev_close() callback. > > Signed-off-by: Maxime Coquelin > --- > drivers/net/virtio/virtio_vdpa.c | 52 ++++++++++++++++++++++++++++++++ > 1 file changed, 52 insertions(+) > > diff --git a/drivers/net/virtio/virtio_vdpa.c b/drivers/net/virtio/virtio_vdpa.c > index 13b4dd07d..691844906 100644 > --- a/drivers/net/virtio/virtio_vdpa.c > +++ b/drivers/net/virtio/virtio_vdpa.c > @@ -436,6 +436,33 @@ virtio_vdpa_start(struct virtio_vdpa_device *dev) > return ret; > } > > +static void > +virtio_vdpa_stop(struct virtio_vdpa_device *dev) > +{ > + struct virtio_hw *hw = &dev->hw; > + uint32_t i, nr_vring; > + int vid = dev->vid; > + struct rte_vhost_vring vr; > + uint16_t last_used_idx, last_avail_idx; > + > + nr_vring = rte_vhost_get_vring_num(vid); > + > + vtpci_reset(hw); > + > + for (i = 0; i < nr_vring; i++) { > + rte_vhost_get_vhost_vring(vid, i, &vr); > + > + last_used_idx = vr.used->idx; > + last_avail_idx = vr.avail->idx; This only works in split ring. Regards, Tiwei > + > + rte_vhost_set_vring_base(vid, i, last_avail_idx, > + last_used_idx); > + } > + > + rte_free(dev->vqs); > + dev->vqs = NULL; > +} > +