From: Jianfeng Tan <jianfeng.tan@intel.com>
To: dev@dpdk.org
Cc: yuanhan.liu@linux.intel.com, maxime.coquelin@redhat.com,
thomas@monjalon.net, Jianfeng Tan <jianfeng.tan@intel.com>
Subject: [dpdk-dev] [PATCH v2 2/4] net/virtio: clean up LSC setting
Date: Thu, 27 Apr 2017 07:35:37 +0000 [thread overview]
Message-ID: <1493278539-44617-3-git-send-email-jianfeng.tan@intel.com> (raw)
In-Reply-To: <1493278539-44617-1-git-send-email-jianfeng.tan@intel.com>
LSC flag is set in several places, but only the last one takes effect;
so we remove the redundant ones and just keep the last one.
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
drivers/net/virtio/virtio_ethdev.c | 7 ++-----
drivers/net/virtio/virtio_pci.c | 21 ++-------------------
drivers/net/virtio/virtio_pci.h | 3 +--
3 files changed, 5 insertions(+), 26 deletions(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index e6c57b3..e79748e 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1353,6 +1353,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
rte_eth_copy_pci_info(eth_dev, pci_dev);
}
+ eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
/* If host does not support both status and MSI-X then disable LSC */
if (vtpci_with_feature(hw, VIRTIO_NET_F_STATUS) && hw->use_msix)
eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC;
@@ -1521,7 +1522,6 @@ int
eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
{
struct virtio_hw *hw = eth_dev->data->dev_private;
- uint32_t dev_flags = RTE_ETH_DEV_DETACHABLE;
int ret;
RTE_BUILD_BUG_ON(RTE_PKTMBUF_HEADROOM < sizeof(struct virtio_net_hdr_mrg_rxbuf));
@@ -1561,14 +1561,11 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
* virtio_user_eth_dev_alloc() before eth_virtio_dev_init() is called.
*/
if (!hw->virtio_user_dev) {
- ret = vtpci_init(RTE_DEV_TO_PCI(eth_dev->device), hw,
- &dev_flags);
+ ret = vtpci_init(RTE_DEV_TO_PCI(eth_dev->device), hw);
if (ret)
return ret;
}
- eth_dev->data->dev_flags = dev_flags;
-
/* reset device and negotiate default features */
ret = virtio_init_device(eth_dev, VIRTIO_PMD_DEFAULT_GUEST_FEATURES);
if (ret < 0)
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index ecad46e..1e17757 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -305,21 +305,6 @@ legacy_virtio_has_msix(const struct rte_pci_addr *loc __rte_unused)
}
#endif
-static int
-legacy_virtio_resource_init(struct rte_pci_device *pci_dev,
- struct virtio_hw *hw, uint32_t *dev_flags)
-{
- if (rte_eal_pci_ioport_map(pci_dev, 0, VTPCI_IO(hw)) < 0)
- return -1;
-
- if (pci_dev->intr_handle.type != RTE_INTR_HANDLE_UNKNOWN)
- *dev_flags |= RTE_ETH_DEV_INTR_LSC;
- else
- *dev_flags &= ~RTE_ETH_DEV_INTR_LSC;
-
- return 0;
-}
-
const struct virtio_pci_ops legacy_ops = {
.read_dev_cfg = legacy_read_dev_config,
.write_dev_cfg = legacy_write_dev_config,
@@ -712,8 +697,7 @@ virtio_read_caps(struct rte_pci_device *dev, struct virtio_hw *hw)
* Return 0 on success.
*/
int
-vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw,
- uint32_t *dev_flags)
+vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw)
{
/*
* Try if we can succeed reading virtio pci caps, which exists
@@ -724,12 +708,11 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw,
PMD_INIT_LOG(INFO, "modern virtio pci detected.");
virtio_hw_internal[hw->port_id].vtpci_ops = &modern_ops;
hw->modern = 1;
- *dev_flags |= RTE_ETH_DEV_INTR_LSC;
return 0;
}
PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");
- if (legacy_virtio_resource_init(dev, hw, dev_flags) < 0) {
+ if (rte_eal_pci_ioport_map(dev, 0, VTPCI_IO(hw)) < 0) {
if (dev->kdrv == RTE_KDRV_UNKNOWN &&
(!dev->device.devargs ||
dev->device.devargs->type !=
diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h
index e7290d7..5651eb5 100644
--- a/drivers/net/virtio/virtio_pci.h
+++ b/drivers/net/virtio/virtio_pci.h
@@ -321,8 +321,7 @@ vtpci_with_feature(struct virtio_hw *hw, uint64_t bit)
/*
* Function declaration from virtio_pci.c
*/
-int vtpci_init(struct rte_pci_device *, struct virtio_hw *,
- uint32_t *dev_flags);
+int vtpci_init(struct rte_pci_device *, struct virtio_hw *);
void vtpci_reset(struct virtio_hw *);
void vtpci_reinit_complete(struct virtio_hw *);
--
2.7.4
next prev parent reply other threads:[~2017-04-27 7:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-26 4:52 [dpdk-dev] [PATCH 0/3] Some fixes on virtio LSC Jianfeng Tan
2017-04-26 4:52 ` [dpdk-dev] [PATCH 1/3] net/virtio: fix wrong MSI-X for modern devices Jianfeng Tan
2017-04-26 4:52 ` [dpdk-dev] [PATCH 2/3] net/virtio: clean up LSC setting Jianfeng Tan
2017-04-26 5:32 ` Yuanhan Liu
2017-04-26 5:44 ` Tan, Jianfeng
2017-04-26 5:52 ` Yuanhan Liu
2017-04-26 6:00 ` Tan, Jianfeng
2017-04-26 15:11 ` Michael S. Tsirkin
2017-04-27 7:34 ` Tan, Jianfeng
2017-04-26 4:52 ` [dpdk-dev] [PATCH 3/3] net/virtio: fix link status always being down Jianfeng Tan
2017-04-27 7:35 ` [dpdk-dev] [PATCH v2 0/4] fixes and cleanup on virtio LSC Jianfeng Tan
2017-04-27 7:35 ` [dpdk-dev] [PATCH v2 1/4] net/virtio: fix wrong MSI-X for modern devices Jianfeng Tan
2017-04-27 7:35 ` Jianfeng Tan [this message]
2017-04-27 7:49 ` [dpdk-dev] [PATCH v2 2/4] net/virtio: clean up LSC setting Yuanhan Liu
2017-04-28 4:48 ` Yuanhan Liu
2017-04-27 7:35 ` [dpdk-dev] [PATCH v2 3/4] net/virtio: remove redundant MSI-X detection Jianfeng Tan
2017-04-27 7:35 ` [dpdk-dev] [PATCH v2 4/4] net/virtio: fix link status always being down Jianfeng Tan
2017-04-28 4:41 ` [dpdk-dev] [PATCH v2 0/4] fixes and cleanup on virtio LSC Yuanhan Liu
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=1493278539-44617-3-git-send-email-jianfeng.tan@intel.com \
--to=jianfeng.tan@intel.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
--cc=thomas@monjalon.net \
--cc=yuanhan.liu@linux.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).