diff mbox

[dpdk-dev,1/3] net/virtio: fix dev detachable flag

Message ID 1487599487-12574-1-git-send-email-hanxueluo@126.com (mailing list archive)
State Rejected, archived
Delegated to: Yuanhan Liu
Headers show

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK

Commit Message

hanxueluo@126.com Feb. 20, 2017, 2:04 p.m. UTC
From: Huanle Han <hanxueluo@gmail.com>

The dev detachable flag was removed by
commit f229eb4 ("net/virtio: fix rewriting LSC flag").

Signed-off-by: Huanle Han <hanxueluo@gmail.com>
---
 drivers/net/virtio/virtio_ethdev.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Yuanhan Liu Feb. 22, 2017, 2:34 a.m. UTC | #1
On Mon, Feb 20, 2017 at 10:04:45PM +0800, hanxueluo@126.com wrote:
> From: Huanle Han <hanxueluo@gmail.com>
> 
> The dev detachable flag was removed by
> commit f229eb4 ("net/virtio: fix rewriting LSC flag").
> 
> Signed-off-by: Huanle Han <hanxueluo@gmail.com>
> ---
>  drivers/net/virtio/virtio_ethdev.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index 4dc03b9..8465e1a 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1336,6 +1336,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
>  	if (eth_dev->device) {
>  		pci_dev = RTE_DEV_TO_PCI(eth_dev->device);
>  		rte_eth_copy_pci_info(eth_dev, pci_dev);
> +		eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;

This is a partial fix. The major issue here is rte_eth_copy_pci_info has
an undocumented side effect: it resets the dev_flags unconditionally. 

Removing such reset should be able to fix it: it also looks like the right
fix to me. Thomas, Ferruh?

If not, we could at least call rte_eth_copy_pci_info() at eth_virtio_dev_init(),
before we set any dev_flags bits.

	--yliu
Yuanhan Liu April 28, 2017, 4:58 a.m. UTC | #2
On Wed, Feb 22, 2017 at 10:34:23AM +0800, Yuanhan Liu wrote:
> On Mon, Feb 20, 2017 at 10:04:45PM +0800, hanxueluo@126.com wrote:
> > From: Huanle Han <hanxueluo@gmail.com>
> > 
> > The dev detachable flag was removed by
> > commit f229eb4 ("net/virtio: fix rewriting LSC flag").
> > 
> > Signed-off-by: Huanle Han <hanxueluo@gmail.com>
> > ---
> >  drivers/net/virtio/virtio_ethdev.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> > index 4dc03b9..8465e1a 100644
> > --- a/drivers/net/virtio/virtio_ethdev.c
> > +++ b/drivers/net/virtio/virtio_ethdev.c
> > @@ -1336,6 +1336,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
> >  	if (eth_dev->device) {
> >  		pci_dev = RTE_DEV_TO_PCI(eth_dev->device);
> >  		rte_eth_copy_pci_info(eth_dev, pci_dev);
> > +		eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
> 
> This is a partial fix. The major issue here is rte_eth_copy_pci_info has
> an undocumented side effect: it resets the dev_flags unconditionally. 
> 
> Removing such reset should be able to fix it: it also looks like the right
> fix to me. Thomas, Ferruh?
> 
> If not, we could at least call rte_eth_copy_pci_info() at eth_virtio_dev_init(),
> before we set any dev_flags bits.

This issue has been fixed by http://dpdk.org/dev/patchwork/patch/23949/.

	--yliu
diff mbox

Patch

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 4dc03b9..8465e1a 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1336,6 +1336,7 @@  virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
 	if (eth_dev->device) {
 		pci_dev = RTE_DEV_TO_PCI(eth_dev->device);
 		rte_eth_copy_pci_info(eth_dev, pci_dev);
+		eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
 	}
 
 	/* If host does not support status then disable LSC */