From patchwork Mon Oct 23 01:46:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ma, WenwuX" X-Patchwork-Id: 133119 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 5AD18431DA; Mon, 23 Oct 2023 03:46:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2922640284; Mon, 23 Oct 2023 03:46:32 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 24CDD40262; Mon, 23 Oct 2023 03:46:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698025590; x=1729561590; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=j7SYO3Sa/fGCYYfHlUdqyQMy4u7J3KDrwjZp0reI91w=; b=kbYuM5blVEChKQH1W2RiAEQKhHIRH3RU/yLnAwCnAls+HsWRjMh2/ina aDmaPSlGFwS+Yy3NUBvq4itvbpLazGB2+3ylrxN19OrlUo1UAnlb3/Vd1 56rCouJOy6l54NPZmbTlxkCnUkxVbOGeBGnwUKIAWdLuloi4iWJQjkuNU zIg91XjXRD9Uer2NwAXt9D1yFZLyrWjAGq/vdNjMk9G9lh9nOe2lSa2C5 bi1DI5xmyOP8RMpGjQfcBLl1ZWHyL7TKY4zUgNJK8aCNBmhQWDgWz3HZB YsKWc3SPPBUsConI6Lmo1nwJ5jgrCMNbjnG29yR8QRhaIcH/mxW3VqWCI A==; X-IronPort-AV: E=McAfee;i="6600,9927,10871"; a="417878069" X-IronPort-AV: E=Sophos;i="6.03,244,1694761200"; d="scan'208";a="417878069" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2023 18:46:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10871"; a="707768597" X-IronPort-AV: E=Sophos;i="6.03,244,1694761200"; d="scan'208";a="707768597" Received: from unknown (HELO dut220..) ([10.239.252.220]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2023 18:46:26 -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 v2] net/virtio: fix link state interrupt vector setting Date: Mon, 23 Oct 2023 09:46:12 +0800 Message-Id: <20231023014613.930292-1-wenwux.ma@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230807031516.1332914-1-wenwux.ma@intel.com> References: <20230807031516.1332914-1-wenwux.ma@intel.com> 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 --- v2: - rewording of the title --- 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 3ab56ef769..c2c0a1a111 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) &&