DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: dev <dev@dpdk.org>, "Wang, Yinan" <yinan.wang@intel.com>,
	 "Xia, Chenbo" <chenbo.xia@intel.com>,
	Adrian Moreno Zapata <amorenoz@redhat.com>,
	 Wei Ling <weix.ling@intel.com>, Yu Jiang <yux.jiang@intel.com>
Subject: Re: [dpdk-dev] [PATCH] net/virtio: fix Virtio-PCI ops assignment
Date: Mon, 1 Feb 2021 17:32:12 +0100	[thread overview]
Message-ID: <CAJFAV8yia96yAf5iy3CUtfq7-=iM6JasR+54ftpSDnrcR4m3gA@mail.gmail.com> (raw)
In-Reply-To: <20210201151630.54564-1-maxime.coquelin@redhat.com>

On Mon, Feb 1, 2021 at 4:16 PM Maxime Coquelin
<maxime.coquelin@redhat.com> wrote:
>
> VIRTIO_OPS() macro relies on the port ID stored in the
> virtio_hw struct. Issue is that it is used before being
> assigned at init time. It results in all devices setting
> ops on port ID 0, causing crash later when calling ops
> for port IDs other than 0.
>
> This patch ensure port ID assignment is done before being
> used.
>
> Bugzilla ID: 631
> Fixes: 512e27eeb743 ("net/virtio: move PCI specific dev init to PCI ethdev init")
>
> Reported-by: Wei Ling <weix.ling@intel.com>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  drivers/net/virtio/virtio_pci_ethdev.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
> index 1b818c4565..547cb8ffa0 100644
> --- a/drivers/net/virtio/virtio_pci_ethdev.c
> +++ b/drivers/net/virtio/virtio_pci_ethdev.c
> @@ -76,6 +76,9 @@ eth_virtio_pci_init(struct rte_eth_dev *eth_dev)
>         struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
>         int ret;
>
> +       /* Required to assign Virtio ops */
> +       hw->port_id = eth_dev->data->port_id;
> +
>         if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
>                 ret = vtpci_init(RTE_ETH_DEV_TO_PCI(eth_dev), dev);
>                 if (ret) {

We probably don't need to set hw->port-id in eth_virtio_dev_init anymore.
And I would only set it in the primary process context, letting the
secondary pick what has been chosen by the primary?


-- 
David Marchand


  reply	other threads:[~2021-02-01 16:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-01 15:16 Maxime Coquelin
2021-02-01 16:32 ` David Marchand [this message]
2021-02-01 16:53   ` Maxime Coquelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJFAV8yia96yAf5iy3CUtfq7-=iM6JasR+54ftpSDnrcR4m3gA@mail.gmail.com' \
    --to=david.marchand@redhat.com \
    --cc=amorenoz@redhat.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=weix.ling@intel.com \
    --cc=yinan.wang@intel.com \
    --cc=yux.jiang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).