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 5CDA9A034F; Wed, 6 May 2020 17:07:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9B5921D724; Wed, 6 May 2020 17:07:38 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 17CDB1D708 for ; Wed, 6 May 2020 17:07:36 +0200 (CEST) IronPort-SDR: 9YVQf2vuGSQBgoBeiLFypSgxqvXvFSifa4141M8a1s4j5KScfxK0Jolrfr98/Sm0eKkkI4yVSx Ecevgpem6mlQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2020 08:07:32 -0700 IronPort-SDR: iGJeDVH+cLhGtOnS5fvWlHMR58zhmN1JrXr6wtK0IAQCHO+4CE/HVKwER9Jx6iEPRS+QJDVgFy b+gTjOyss7YQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,359,1583222400"; d="scan'208";a="284650152" Received: from npg-dpdk-virtual-marvin-dev.sh.intel.com ([10.67.119.56]) by fmsmga004.fm.intel.com with ESMTP; 06 May 2020 08:07:28 -0700 From: Marvin Liu To: maxime.coquelin@redhat.com, xiaolong.ye@intel.com, zhihong.wang@intel.com Cc: dev@dpdk.org, Marvin Liu Date: Wed, 6 May 2020 23:07:24 +0800 Message-Id: <20200506150724.37170-1-yong.liu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200414125555.86601-1-yong.liu@intel.com> References: <20200414125555.86601-1-yong.liu@intel.com> Subject: [dpdk-dev] [PATCH v2] net/virtio: fix crash when device reconnecting X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When doing virtio device initialization, virtqueues will be reset in server mode if ring type is packed. It will cause issue because queues have been freed in the beginning of device initialization. Fix this issue by checking whether device has been initialized before reset. If device hasn't been initialized, there's no need to reset queues. Fixes: 6ebbf4109f35 ("net/virtio-user: fix packed ring server mode") Signed-off-by: Marvin Liu diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index c54698ad1..55bd81f0b 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -89,7 +89,8 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev) dev->features &= dev->device_features; /* For packed ring, resetting queues is required in reconnection. */ - if (vtpci_packed_queue(hw)) { + if (vtpci_packed_queue(hw) && + (vtpci_get_status(hw) & VIRTIO_CONFIG_STATUS_DRIVER_OK)) { PMD_INIT_LOG(NOTICE, "Packets on the fly will be dropped" " when packed ring reconnecting."); virtio_user_reset_queues_packed(eth_dev); -- 2.17.1