Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 863E0C433F5 for ; Tue, 16 Nov 2021 08:41:05 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id 08FDB61AD2 for ; Tue, 16 Nov 2021 08:41:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 08FDB61AD2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dpdk.org 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