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 62AB6A0A02; Thu, 14 Jan 2021 10:25:12 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0E4C8141011; Thu, 14 Jan 2021 10:25:12 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 7CC98141010 for ; Thu, 14 Jan 2021 10:25:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610616309; 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=540ohtU54O5B3JRxnyfWES1bMRpAEhAb3hvqL0daGMg=; b=PSkenPeHGqAhQeFCJIpMlfnGjtJDiMUOqKoZskTMMuK0f3utgJ/KjPxomCiuO83d4goecM SX6puJEjjYwV+UxZgCiA5V/cuoLvgStRd4eZxhO/7g6S21St+A6xMPXZ2l+hr7i6KMTNcz TxZB5GmGn8qnjwnmlEp1hmXvZ2kFEhY= 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-145-QBV8XFzpMsK4471iucicWw-1; Thu, 14 Jan 2021 04:25:05 -0500 X-MC-Unique: QBV8XFzpMsK4471iucicWw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3F89DBBEE1; Thu, 14 Jan 2021 09:25:04 +0000 (UTC) Received: from [10.36.110.24] (unknown [10.36.110.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1DAC25F70B; Thu, 14 Jan 2021 09:24:59 +0000 (UTC) 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> From: Maxime Coquelin Message-ID: Date: Thu, 14 Jan 2021 10:24:58 +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.79 on 10.5.11.16 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: 8bit 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/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. > >> 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. > > >> ret = vtpci_init(RTE_ETH_DEV_TO_PCI(eth_dev), hw); >> 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: > >