From patchwork Fri Jan 5 13:37:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zhang X-Patchwork-Id: 135738 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7695343837; Fri, 5 Jan 2024 06:09:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 078894027C; Fri, 5 Jan 2024 06:09:36 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by mails.dpdk.org (Postfix) with ESMTP id 6B86A40267 for ; Fri, 5 Jan 2024 06:09:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704431373; x=1735967373; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=+FI6LhEWDa9lzyQZia0VpvR8mhvJ7hABxTx9bqEr/f0=; b=Mq3jQT4KrqphGhkjioinTzmegyqHWWlVqXU1Y+yexHwEF61IOAbMGAKZ JKDenfPMIUr4lpxtGjbO87PYvmFHv4qk77t/CD0ecx2EGIc9ASUL0/Dlq IxFzSrlbeuCKtE0geEIxHyGaAi1MfDj04yjNrA6TZs9zK5FD1el0qllz3 I61uyKy+YainPAF5wc9ah9fXSQjXlqV1hfnw82B6pYTBwZoMqdfztTMPS aY5KfUUyArNW2g8IHxXqWu4evFppn5v+j1Lk5n/IOKJtKbhr8eqs4IvXQ 1bxaRE5l/36juyHjF7jL51V9Su01zIcIYOiep+R4HdxxApTTpzNXAgkvs g==; X-IronPort-AV: E=McAfee;i="6600,9927,10943"; a="4793805" X-IronPort-AV: E=Sophos;i="6.04,332,1695711600"; d="scan'208";a="4793805" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jan 2024 21:09:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10943"; a="756842045" X-IronPort-AV: E=Sophos;i="6.04,332,1695711600"; d="scan'208";a="756842045" Received: from dpdk-qzhan15-test02.sh.intel.com ([10.67.119.16]) by orsmga006.jf.intel.com with ESMTP; 04 Jan 2024 21:09:30 -0800 From: Qi Zhang To: qiming.yang@intel.com, wenjun1.wu@intel.com Cc: dev@dpdk.org, Qi Zhang Subject: [PATCH] net/ice: refine queue start stop Date: Fri, 5 Jan 2024 08:37:05 -0500 Message-Id: <20240105133705.360750-1-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 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 Not necessary to return fail when starting or stopping a queue if the queue was already at required state. Signed-off-by: Qi Zhang Acked-by: Wenjun Wu --- drivers/net/ice/ice_rxtx.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 73e47ae92d..3286bb08fe 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -673,6 +673,10 @@ ice_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) return -EINVAL; } + if (dev->data->rx_queue_state[rx_queue_id] == + RTE_ETH_QUEUE_STATE_STARTED) + return 0; + if (dev->data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) rxq->ts_enable = true; err = ice_program_hw_rx_queue(rxq); @@ -717,6 +721,10 @@ ice_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id) if (rx_queue_id < dev->data->nb_rx_queues) { rxq = dev->data->rx_queues[rx_queue_id]; + if (dev->data->rx_queue_state[rx_queue_id] == + RTE_ETH_QUEUE_STATE_STOPPED) + return 0; + err = ice_switch_rx_queue(hw, rxq->reg_idx, false); if (err) { PMD_DRV_LOG(ERR, "Failed to switch RX queue %u off", @@ -758,6 +766,10 @@ ice_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id) return -EINVAL; } + if (dev->data->tx_queue_state[tx_queue_id] == + RTE_ETH_QUEUE_STATE_STARTED) + return 0; + buf_len = ice_struct_size(txq_elem, txqs, 1); txq_elem = ice_malloc(hw, buf_len); if (!txq_elem) @@ -1066,6 +1078,10 @@ ice_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) return -EINVAL; } + if (dev->data->tx_queue_state[tx_queue_id] == + RTE_ETH_QUEUE_STATE_STOPPED) + return 0; + q_ids[0] = txq->reg_idx; q_teids[0] = txq->q_teid;