From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A70EFA09FF; Tue, 5 Jan 2021 22:15:44 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C3A501607D9; Tue, 5 Jan 2021 22:15:43 +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 8CBBB1607D8 for ; Tue, 5 Jan 2021 22:15:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609881342; 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: in-reply-to:in-reply-to:references:references; bh=9Kdu/b+X1r1iDlVVTMIbUCA4UZh2xUdrLYVQdFX2nu4=; b=OtQX8zFakYcyJFe9DV3huEffl912rBetJm9tTs2RU1eZOGp9vFgstzAdrPRsjnwtl1utH5 SIX3bm40JHzjatw0FCLtFlQ3xUhbyTJR3MOjHNuJRkIBXOpQCOEByQNYMDfLlLbbI6Y5fM aSpB8uBeMV/EoY/6QAbYS7lQwcpz1xk= Received: from mail-vk1-f198.google.com (mail-vk1-f198.google.com [209.85.221.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-310-A12xwZEWPLmLHb0lPP2SDQ-1; Tue, 05 Jan 2021 16:15:40 -0500 X-MC-Unique: A12xwZEWPLmLHb0lPP2SDQ-1 Received: by mail-vk1-f198.google.com with SMTP id j67so503793vkh.15 for ; Tue, 05 Jan 2021 13:15:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9Kdu/b+X1r1iDlVVTMIbUCA4UZh2xUdrLYVQdFX2nu4=; b=SI0Hy34nYIR4R6/6Llc06pRBt7+S8fzW9l01uTAmJAsl2MP3TePStuSQtBUyLm5QD7 yRVFM8yHWxVf8p/LjnutsQ7SQPD1EdkKB9PZco0fnmTwz/RtMM02dPoDjQYIngGrfR8c ihVMSkA2LNMZE0wX9nBxEboO7ehm4dIPoQXJR4h0YvYFZ2cNRjFsFQaVuYZJhM0CLWg4 eIGQRXIdlJHcK/bNdqDD4M+EqEeqX7duU3V7QuNS9s3JtEOtcNt6//VnuDX6CECfFFoj fBuLAOGISItk+DBGlfwXOjICxN8K2WcPD+O1678CJxkirYbKdfhbgaan7D6I+dY3jscJ /ZNQ== X-Gm-Message-State: AOAM5306WAsWK7KqTs6rmNqWxKvypzN5kHlTmJIfjZ4cSdclStW7TXcm 1VKet2QeErmyvCOe68ZgUbsfS4E9bqZ8mVoGBa4pg6TK5YPGhrfNnYCSms2g5PK3M0ENQ4IC5fg /I5H/JvsQ+/CmF8Luq9o= X-Received: by 2002:a67:ecd5:: with SMTP id i21mr955348vsp.18.1609881340091; Tue, 05 Jan 2021 13:15:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJwZKC8WlfHIQuKcOhyVCfln4IMd1bdaDX+JqlZNo1oAmQqFfzTwRkazXDdpyL7giEIM98Z7l89/Do/bByNSu88= X-Received: by 2002:a67:ecd5:: with SMTP id i21mr955341vsp.18.1609881339909; Tue, 05 Jan 2021 13:15:39 -0800 (PST) MIME-Version: 1.0 References: <20201220211405.313012-1-maxime.coquelin@redhat.com> <20201220211405.313012-3-maxime.coquelin@redhat.com> In-Reply-To: <20201220211405.313012-3-maxime.coquelin@redhat.com> From: David Marchand Date: Tue, 5 Jan 2021 22:15:28 +0100 Message-ID: To: Maxime Coquelin Cc: dev , "Xia, Chenbo" , Olivier Matz , Adrian Moreno Zapata Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" 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 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. > - 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. > 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: -- David Marchand