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 179D1A0C50; Fri, 16 Jul 2021 16:28:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0138841384; Fri, 16 Jul 2021 16:28:54 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 231834137F for ; Fri, 16 Jul 2021 16:28:51 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10046"; a="210786511" X-IronPort-AV: E=Sophos;i="5.84,245,1620716400"; d="scan'208";a="210786511" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2021 07:28:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,245,1620716400"; d="scan'208";a="460770077" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.27]) by orsmga008.jf.intel.com with ESMTP; 16 Jul 2021 07:28:49 -0700 From: Ferruh Yigit To: Andrew Rybchenko , Thomas Monjalon Cc: Ferruh Yigit , dev@dpdk.org Date: Fri, 16 Jul 2021 15:27:59 +0100 Message-Id: <20210716142800.3853651-7-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210716142800.3853651-1-ferruh.yigit@intel.com> References: <20210617081449.2045195-1-ferruh.yigit@intel.com> <20210716142800.3853651-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [RFC v2 7/8] test/virtual_pmd: support queue start/stop 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 Sender: "dev" Signed-off-by: Ferruh Yigit --- app/test/virtual_pmd.c | 52 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c index 27c8501b96a7..4b8318cf39dd 100644 --- a/app/test/virtual_pmd.c +++ b/app/test/virtual_pmd.c @@ -35,11 +35,35 @@ struct virtual_ethdev_queue { struct rte_eth_rxconf rx_conf; }; +static int +virtual_ethdev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t queue_id) +{ + eth_dev->data->rx_queue_state[queue_id] = RTE_ETH_QUEUE_STATE_STARTED; + + return 0; +} + +static int +virtual_ethdev_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t queue_id) +{ + eth_dev->data->tx_queue_state[queue_id] = RTE_ETH_QUEUE_STATE_STARTED; + + return 0; +} + static int virtual_ethdev_start_success(struct rte_eth_dev *eth_dev) { + int i; + eth_dev->data->dev_started = 1; + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) + virtual_ethdev_rx_queue_start(eth_dev, i); + + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) + virtual_ethdev_tx_queue_start(eth_dev, i); + return 0; } @@ -50,10 +74,34 @@ virtual_ethdev_start_fail(struct rte_eth_dev *eth_dev) return -1; } + +static int +virtual_ethdev_rx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t queue_id) +{ + eth_dev->data->rx_queue_state[queue_id] = RTE_ETH_QUEUE_STATE_STOPPED; + + return 0; +} + +static int +virtual_ethdev_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t queue_id) +{ + eth_dev->data->tx_queue_state[queue_id] = RTE_ETH_QUEUE_STATE_STOPPED; + + return 0; +} + static int virtual_ethdev_stop(struct rte_eth_dev *eth_dev) { void *pkt = NULL; struct virtual_ethdev_private *prv = eth_dev->data->dev_private; + int i; + + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) + virtual_ethdev_rx_queue_stop(eth_dev, i); + + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) + virtual_ethdev_tx_queue_stop(eth_dev, i); eth_dev->data->dev_link.link_status = ETH_LINK_DOWN; eth_dev->data->dev_started = 0; @@ -271,6 +319,10 @@ static const struct eth_dev_ops virtual_ethdev_default_dev_ops = { .dev_stop = virtual_ethdev_stop, .dev_close = virtual_ethdev_close, .dev_infos_get = virtual_ethdev_info_get, + .rx_queue_start = virtual_ethdev_rx_queue_start, + .tx_queue_start = virtual_ethdev_tx_queue_start, + .rx_queue_stop = virtual_ethdev_rx_queue_stop, + .tx_queue_stop = virtual_ethdev_tx_queue_stop, .rx_queue_setup = virtual_ethdev_rx_queue_setup_success, .tx_queue_setup = virtual_ethdev_tx_queue_setup_success, .rxq_info_get = virtual_ethdev_rx_info_get, -- 2.31.1