> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> Sent: Saturday, August 29, 2015 12:24 AM
> To: Xie, Huawei; Ouyang, Changchun
> Cc: dev at dpdk.org; Stephen Hemminger; Stephen Hemminger
> Subject: [PATCH 1/3] virtio: don't report link state feature unless available
> 
> From: Stephen Hemminger <shemming at brocade.com>
> 
> If host does not support virtio link state (like current DPDK vhost) then 
> don't
> set the flag. This keeps applications from incorrectly assuming that link 
> state
> is available when it is not. It also avoids useless "guess what works in the
> config".
> 
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>

Acked-by: Changchun Ouyang <changchun.ouyang at intel.com>

> ---
>  drivers/net/virtio/virtio_ethdev.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c
> b/drivers/net/virtio/virtio_ethdev.c
> index 465d3cd..8c3e924 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1201,6 +1201,10 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
>       vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER);
>       virtio_negotiate_features(hw);
> 
> +     /* If host does not support status then disable LSC */
> +     if (!vtpci_with_feature(hw, VIRTIO_NET_F_STATUS))
> +             pci_dev->driver->drv_flags &= ~RTE_PCI_DRV_INTR_LSC;
> +
>       rx_func_get(eth_dev);
> 
>       /* Setting up rx_header size for the device */ @@ -1394,9 +1398,8
> @@ virtio_dev_start(struct rte_eth_dev *dev)
>       struct rte_pci_device *pci_dev = dev->pci_dev;
> 
>       /* check if lsc interrupt feature is enabled */
> -     if ((dev->data->dev_conf.intr_conf.lsc) &&
> -             (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC)) {
> -             if (!vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) {
> +     if (dev->data->dev_conf.intr_conf.lsc) {
> +             if (!(pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC))
> {
>                       PMD_DRV_LOG(ERR, "link status not supported by
> host");
>                       return -ENOTSUP;
>               }
> --
> 2.1.4

Reply via email to