From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 916BBA0C43; Tue, 16 Nov 2021 09:41:04 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3EB6740141; Tue, 16 Nov 2021 09:41:04 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id C258740040 for ; Tue, 16 Nov 2021 09:41:02 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10169"; a="233485300" X-IronPort-AV: E=Sophos;i="5.87,238,1631602800"; d="scan'208";a="233485300" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Nov 2021 00:41:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,238,1631602800"; d="scan'208";a="506338681" Received: from limiao-icelake.sh.intel.com ([10.67.115.126]) by orsmga008.jf.intel.com with ESMTP; 16 Nov 2021 00:41:00 -0800 From: Miao Li To: dev@dpdk.org Cc: chenbo.xia@intel.com, maxime.coquelin@redhat.com Subject: [PATCH v1] net/vhost: add queue status check Date: Tue, 16 Nov 2021 16:44:46 +0000 Message-Id: <20211116164446.149453-1-miao.li@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch adds queue status check to make sure that vhost monitor address will not be got until the link between backend and frontend up and the packets are allowed to be queued. Signed-off-by: Miao Li --- drivers/net/vhost/rte_eth_vhost.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 070f0e6dfd..9d600054d8 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -1415,6 +1415,8 @@ vhost_get_monitor_addr(void *rx_queue, struct rte_power_monitor_cond *pmc) int ret; if (vq == NULL) return -EINVAL; + if (unlikely(rte_atomic32_read(&vq->allow_queuing) == 0)) + return -EINVAL; ret = rte_vhost_get_monitor_addr(vq->vid, vq->virtqueue_id, &vhost_pmc); if (ret < 0) -- 2.25.1