From patchwork Mon Aug 7 03:15:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ma, WenwuX" X-Patchwork-Id: 129930 X-Patchwork-Delegate: maxime.coquelin@redhat.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 EF12842F79; Mon, 7 Aug 2023 05:23:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 35CFC43247; Mon, 7 Aug 2023 05:23:17 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 40CFD40A8B; Mon, 7 Aug 2023 05:23:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691378595; x=1722914595; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=/2r5biYI7U0sQwIbCWafiqSOifuBlULeVG35FSlgHDA=; b=Mz5yI8REmDQu1kOufHx0hluqoEppg6OYpgvseKNDDs1nX9L6UOTBGZUw cwULjdzv2ylgJRBQrG4QVE82NZY7LQrvjcON1HcGgIdk1jagU0S8cR0w6 DDvNwwWUKxhjLCfHCXdMeXyG8dfXXexG5aNltLxobvIBPoHKFZKNyeDGF jmNkrGhg2vLA6qQwd9aSGW/GvEQ2XjaTBkcSngRGduKi2NwtImZCbingt iL4k/EFLBEsEfELoF4Wh/5Ftsb1k78tqwIucRFVwoh5iIFnAPub6dU9C8 kJvQQEBdvkECVkl30V7EiisnYJbBIbZLdjt9ZBD2zsei3eTxFwGfZE0+T A==; X-IronPort-AV: E=McAfee;i="6600,9927,10794"; a="434289882" X-IronPort-AV: E=Sophos;i="6.01,261,1684825200"; d="scan'208";a="434289882" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Aug 2023 20:23:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10794"; a="800781940" X-IronPort-AV: E=Sophos;i="6.01,261,1684825200"; d="scan'208";a="800781940" Received: from unknown (HELO localhost.localdomain) ([10.239.252.251]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Aug 2023 20:23:11 -0700 From: Wenwu Ma To: maxime.coquelin@redhat.com, dev@dpdk.org Cc: chenbo.xia@intel.com, weix.ling@intel.com, Wenwu Ma , stable@dpdk.org Subject: [PATCH] net/virtio: fix the setting of the vector for link state interrupt Date: Mon, 7 Aug 2023 11:15:16 +0800 Message-Id: <20230807031516.1332914-1-wenwux.ma@intel.com> X-Mailer: git-send-email 2.25.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 The settings of the vector for link state interrupts should be done before the initialization of the device is completed. Fixes: ee85024cf5f7 ("net/virtio: complete init stage at the right place") Cc: stable@dpdk.org Signed-off-by: Wenwu Ma Tested-by: Wei Ling Reviewed-by: Maxime Coquelin --- drivers/net/virtio/virtio_ethdev.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 2c23f1c00e..1801b0ae47 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1912,6 +1912,14 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) } } + if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) + /* Enable vector (0) for Link State Interrupt */ + if (VIRTIO_OPS(hw)->set_config_irq(hw, 0) == + VIRTIO_MSI_NO_VECTOR) { + PMD_DRV_LOG(ERR, "failed to set config vector"); + return -EBUSY; + } + virtio_reinit_complete(hw); return 0; @@ -2237,14 +2245,6 @@ virtio_dev_configure(struct rte_eth_dev *dev) hw->has_tx_offload = tx_offload_enabled(hw); hw->has_rx_offload = rx_offload_enabled(hw); - if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) - /* Enable vector (0) for Link State Interrupt */ - if (VIRTIO_OPS(hw)->set_config_irq(hw, 0) == - VIRTIO_MSI_NO_VECTOR) { - PMD_DRV_LOG(ERR, "failed to set config vector"); - return -EBUSY; - } - if (virtio_with_packed_queue(hw)) { #if defined(RTE_ARCH_X86_64) && defined(CC_AVX512_SUPPORT) if ((hw->use_vec_rx || hw->use_vec_tx) &&