From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 406F6A09FD; Sun, 20 Dec 2020 22:16:47 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 44F33CCA4; Sun, 20 Dec 2020 22:14:55 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by dpdk.org (Postfix) with ESMTP id 769B3CC64 for ; Sun, 20 Dec 2020 22:14:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608498890; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hDS0HN9mc1mfTLfuC9RWVNb0lJntHMktJrJ6+hQQGL8=; b=i8VYV9LZcBPXM32wWqlgDJE1E159bZx3Exp+fgEmdlX4siGi7pdxoPmyq58bQgjoNj4E+M ge/FWFM6tNuayVrkEIQF3kAcdcNFRRPj6cbzWTRFoWiSmSiKKTlJwVBBVJeTPQl3kpT0Xi uP9oQVlVUuW8YhJtGUtMcbmCZOulzeo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-305-lGqZQxxeNhCyvNrpiNPqmw-1; Sun, 20 Dec 2020 16:14:47 -0500 X-MC-Unique: lGqZQxxeNhCyvNrpiNPqmw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 01145107ACE6; Sun, 20 Dec 2020 21:14:46 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.36.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48ABD60C43; Sun, 20 Dec 2020 21:14:44 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, chenbo.xia@intel.com, olivier.matz@6wind.com, amorenoz@redhat.com, david.marchand@redhat.com Cc: Maxime Coquelin Date: Sun, 20 Dec 2020 22:13:32 +0100 Message-Id: <20201220211405.313012-8-maxime.coquelin@redhat.com> In-Reply-To: <20201220211405.313012-1-maxime.coquelin@redhat.com> References: <20201220211405.313012-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-dev] [PATCH 07/40] net/virtio: move MSIX detection to PCI ethdev X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" There is no point it detecting whether we can use MSIX every time the interrupt is enabled/disabled/masked. Let's do it once for all at PCI device init time. Signed-off-by: Maxime Coquelin --- drivers/net/virtio/virtio_ethdev.c | 15 --------------- drivers/net/virtio/virtio_pci.c | 5 ++++- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 4032a89396..67f6be3fa8 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1282,42 +1282,27 @@ virtio_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) static int virtio_intr_unmask(struct rte_eth_dev *dev) { - struct virtio_hw *hw = dev->data->dev_private; - if (rte_intr_ack(dev->intr_handle) < 0) return -1; - if (hw->bus_type == VIRTIO_BUS_PCI_LEGACY || hw->bus_type == VIRTIO_BUS_PCI_MODERN) - hw->use_msix = vtpci_msix_detect(RTE_ETH_DEV_TO_PCI(dev)); - return 0; } static int virtio_intr_enable(struct rte_eth_dev *dev) { - struct virtio_hw *hw = dev->data->dev_private; - if (rte_intr_enable(dev->intr_handle) < 0) return -1; - if (hw->bus_type == VIRTIO_BUS_PCI_LEGACY || hw->bus_type == VIRTIO_BUS_PCI_MODERN) - hw->use_msix = vtpci_msix_detect(RTE_ETH_DEV_TO_PCI(dev)); - return 0; } static int virtio_intr_disable(struct rte_eth_dev *dev) { - struct virtio_hw *hw = dev->data->dev_private; - if (rte_intr_disable(dev->intr_handle) < 0) return -1; - if (hw->bus_type == VIRTIO_BUS_PCI_LEGACY || hw->bus_type == VIRTIO_BUS_PCI_MODERN) - hw->use_msix = vtpci_msix_detect(RTE_ETH_DEV_TO_PCI(dev)); - return 0; } diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c index 1692268f30..8605254e53 100644 --- a/drivers/net/virtio/virtio_pci.c +++ b/drivers/net/virtio/virtio_pci.c @@ -698,7 +698,7 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw) PMD_INIT_LOG(INFO, "modern virtio pci detected."); virtio_hw_internal[hw->port_id].vtpci_ops = &modern_ops; hw->bus_type = VIRTIO_BUS_PCI_MODERN; - return 0; + goto msix_detect; } PMD_INIT_LOG(INFO, "trying with legacy virtio pci."); @@ -718,6 +718,9 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw) virtio_hw_internal[hw->port_id].vtpci_ops = &legacy_ops; hw->bus_type = VIRTIO_BUS_PCI_LEGACY; +msix_detect: + hw->use_msix = vtpci_msix_detect(dev); + return 0; } -- 2.29.2