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 4C670A0A02; Thu, 14 Jan 2021 11:55:06 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 16ACB141122; Thu, 14 Jan 2021 11:55:06 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mails.dpdk.org (Postfix) with ESMTP id 467A0141121 for ; Thu, 14 Jan 2021 11:55:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610621704; 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=AoyTtUPaZNcTjwy89BESALe8B97rRhFc+g5dUuInh0g=; b=JqFmS3f6DJuNEIYRVzPmbMqeC+mOh7uvtdTuodfJVVP4Xcw8fOYm1yYoo0NBCjv2bKXXuz n+AjL42Klm7eWWR+nYwPI2wVPGEc608D6mMEH88Zrf1LIOBU4VfquWe173ro11xQ8ff8no 8ApHAksftVwb39Hh+75covnXRC6HEPw= 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-402-EFP8XRlEMm2SdiaqDxukZA-1; Thu, 14 Jan 2021 05:55:02 -0500 X-MC-Unique: EFP8XRlEMm2SdiaqDxukZA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B4D4218C89DA; Thu, 14 Jan 2021 10:55:01 +0000 (UTC) Received: from [10.36.110.24] (unknown [10.36.110.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BF81019C71; Thu, 14 Jan 2021 10:54:57 +0000 (UTC) From: Maxime Coquelin To: David Marchand Cc: dev , "Xia, Chenbo" , Olivier Matz , Adrian Moreno Zapata References: <20201220211405.313012-1-maxime.coquelin@redhat.com> <20201220211405.313012-3-maxime.coquelin@redhat.com> Message-ID: <53405a21-588b-71e6-b1e7-71f75acdda05@redhat.com> Date: Thu, 14 Jan 2021 11:54:56 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 02/40] net/virtio: Introduce Virtio bus type 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" On 1/14/21 10:24 AM, Maxime Coquelin wrote: > > > On 1/5/21 10:15 PM, David Marchand wrote: >> On Sun, Dec 20, 2020 at 10:14 PM Maxime Coquelin >> wrote: >>> >>> This patch is preliminary work for introducing a bus layer >>> in Virtio PMD, in order to improve Virtio-user integration. >>> >>> A new bus type is added to provide a unified way to distinguish >>> which bus type is used (PCI modern, PCI legacy or Virtio-user). >> >> In dpdk, we don't use a capital letter for starting a title. >> >> >>> @@ -1883,15 +1883,14 @@ virtio_remap_pci(struct rte_pci_device *pci_dev, struct virtio_hw *hw) >>> static void >>> virtio_set_vtpci_ops(struct virtio_hw *hw) >>> { >>> -#ifdef RTE_VIRTIO_USER >> >> Too soon to remove this check, since virtio_user_ops comes from >> virtio_user_ethdev.c. >> This will break compilation on FreeBSD. > > Agree, I restored it back in v2. > >> >>> - if (hw->virtio_user_dev) >>> + if (hw->bus_type == VIRTIO_BUS_USER) >>> VTPCI_OPS(hw) = &virtio_user_ops; >>> - else >>> -#endif >>> - if (hw->modern) >>> + else if (hw->bus_type == VIRTIO_BUS_PCI_MODERN) >>> VTPCI_OPS(hw) = &modern_ops; >>> - else >>> + else if (hw->bus_type == VIRTIO_BUS_PCI_LEGACY) >>> VTPCI_OPS(hw) = &legacy_ops; >>> + >>> + return; >>> } >>> >>> /* >>> @@ -1919,7 +1918,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) >>> eth_dev->rx_descriptor_done = virtio_dev_rx_queue_done; >>> >>> if (rte_eal_process_type() == RTE_PROC_SECONDARY) { >>> - if (!hw->virtio_user_dev) { >>> + if (hw->bus_type != VIRTIO_BUS_USER) { >> >> In the rest of the patch, we check for PCI types when dealing with PCI >> code, so I'd rather be consistent and check for modern and legacy pci >> types here too. > > Agree, it is not consistent. I fixed it here and below for v2. Wait, as we discussed off-list, we need hw->bus_type != VIRTIO_BUS_USER, as the bus_type is still unknown for PCI bus at that stage. >> >>> ret = virtio_remap_pci(RTE_ETH_DEV_TO_PCI(eth_dev), hw); >>> if (ret) >>> return ret; >>> @@ -1950,7 +1949,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) >>> /* For virtio_user case the hw->virtio_user_dev is populated by >>> * virtio_user_eth_dev_alloc() before eth_virtio_dev_init() is called. >>> */ >>> - if (!hw->virtio_user_dev) { >>> + if (hw->bus_type != VIRTIO_BUS_USER) { >> >> Idem. Same here. >> >> >>> ret = vtpci_init(RTE_ETH_DEV_TO_PCI(eth_dev), hw); bus_type is set to VIRTIO_BUS_PCI_MODERN or VIRTIO_BUS_PCI_LEGACY in vtcpi_init(). >>> if (ret) >>> goto err_vtpci_init; >>> @@ -1982,9 +1981,9 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) >>> return 0; >>> >>> err_virtio_init: >>> - if (!hw->virtio_user_dev) { >>> + if (hw->bus_type == VIRTIO_BUS_PCI_MODERN || hw->bus_type == VIRTIO_BUS_PCI_LEGACY) { >>> rte_pci_unmap_device(RTE_ETH_DEV_TO_PCI(eth_dev)); >>> - if (!hw->modern) >>> + if (hw->bus_type == VIRTIO_BUS_PCI_LEGACY) >>> rte_pci_ioport_unmap(VTPCI_IO(hw)); >>> } >>> err_vtpci_init: >> >> >