DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [dpdk-dev] [PATCH v3 5/7] net/netvsc: don't query VF link state
Date: Tue, 19 May 2020 09:52:28 -0700	[thread overview]
Message-ID: <20200519165230.23306-6-stephen@networkplumber.org> (raw)
In-Reply-To: <20200519165230.23306-1-stephen@networkplumber.org>

When the primary device link state is queried, there is no
need to query the VF state as well. The application only sees
the state of the synthetic device.

Fixes: dc7680e8597c ("net/netvsc: support integrated VF")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/netvsc/hn_ethdev.c |  4 +-
 drivers/net/netvsc/hn_var.h    |  3 --
 drivers/net/netvsc/hn_vf.c     | 98 +++++-----------------------------
 3 files changed, 15 insertions(+), 90 deletions(-)

diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 0f4827c54be4..ac182a548645 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -202,7 +202,7 @@ static int hn_parse_args(const struct rte_eth_dev *dev)
  */
 int
 hn_dev_link_update(struct rte_eth_dev *dev,
-		   int wait_to_complete)
+		   int wait_to_complete __rte_unused)
 {
 	struct hn_data *hv = dev->data->dev_private;
 	struct rte_eth_link link, old;
@@ -216,8 +216,6 @@ hn_dev_link_update(struct rte_eth_dev *dev,
 
 	hn_rndis_get_linkspeed(hv);
 
-	hn_vf_link_update(dev, wait_to_complete);
-
 	link = (struct rte_eth_link) {
 		.link_duplex = ETH_LINK_FULL_DUPLEX,
 		.link_autoneg = ETH_LINK_SPEED_FIXED,
diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h
index 20363389a0d6..881832d85719 100644
--- a/drivers/net/netvsc/hn_var.h
+++ b/drivers/net/netvsc/hn_var.h
@@ -141,7 +141,6 @@ struct hn_data {
 	uint16_t	rss_ind[128];
 
 	struct rte_eth_dev_owner owner;
-	struct rte_intr_handle vf_intr;
 
 	struct vmbus_channel *channels[HN_MAX_CHANNELS];
 };
@@ -228,8 +227,6 @@ int	hn_vf_mc_addr_list(struct rte_eth_dev *dev,
 			   struct rte_ether_addr *mc_addr_set,
 			   uint32_t nb_mc_addr);
 
-int	hn_vf_link_update(struct rte_eth_dev *dev,
-			  int wait_to_complete);
 int	hn_vf_tx_queue_setup(struct rte_eth_dev *dev,
 			     uint16_t queue_idx, uint16_t nb_desc,
 			     unsigned int socket_id,
diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
index a745c7c36ea3..f5f15c046207 100644
--- a/drivers/net/netvsc/hn_vf.c
+++ b/drivers/net/netvsc/hn_vf.c
@@ -97,15 +97,8 @@ int hn_vf_add(struct rte_eth_dev *dev, struct hn_data *hv)
 	}
 
 	err = hn_vf_attach(hv, port);
-	if (err == 0) {
-		dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC;
-		hv->vf_intr = (struct rte_intr_handle) {
-			.fd = -1,
-			.type = RTE_INTR_HANDLE_EXT,
-		};
-		dev->intr_handle = &hv->vf_intr;
+	if (err == 0)
 		hn_nvs_set_datapath(hv, NVS_DATAPATH_VF);
-	}
 
 	return err;
 }
@@ -223,80 +216,6 @@ int hn_vf_info_get(struct hn_data *hv, struct rte_eth_dev_info *info)
 	return ret;
 }
 
-int hn_vf_link_update(struct rte_eth_dev *dev,
-		      int wait_to_complete)
-{
-	struct hn_data *hv = dev->data->dev_private;
-	struct rte_eth_dev *vf_dev;
-	int ret = 0;
-
-	rte_rwlock_read_lock(&hv->vf_lock);
-	vf_dev = hn_get_vf_dev(hv);
-	if (vf_dev && vf_dev->dev_ops->link_update)
-		ret = (*vf_dev->dev_ops->link_update)(vf_dev, wait_to_complete);
-	rte_rwlock_read_unlock(&hv->vf_lock);
-
-	return ret;
-}
-
-/* called when VF has link state interrupts enabled */
-static int hn_vf_lsc_event(uint16_t port_id __rte_unused,
-			   enum rte_eth_event_type event,
-			   void *cb_arg, void *out __rte_unused)
-{
-	struct rte_eth_dev *dev = cb_arg;
-
-	if (event != RTE_ETH_EVENT_INTR_LSC)
-		return 0;
-
-	/* if link state has changed pass on */
-	if (hn_dev_link_update(dev, 0) == 0)
-		return 0; /* no change */
-
-	return _rte_eth_dev_callback_process(dev,
-					     RTE_ETH_EVENT_INTR_LSC,
-					     NULL);
-}
-
-static int _hn_vf_configure(struct rte_eth_dev *dev,
-			    uint16_t vf_port,
-			    const struct rte_eth_conf *dev_conf)
-{
-	struct rte_eth_conf vf_conf = *dev_conf;
-	struct rte_eth_dev *vf_dev;
-	int ret;
-
-	vf_dev = &rte_eth_devices[vf_port];
-	if (dev_conf->intr_conf.lsc &&
-	    (vf_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)) {
-		PMD_DRV_LOG(DEBUG, "enabling LSC for VF %u",
-			    vf_port);
-		vf_conf.intr_conf.lsc = 1;
-	} else {
-		PMD_DRV_LOG(DEBUG, "disabling LSC for VF %u",
-			    vf_port);
-		vf_conf.intr_conf.lsc = 0;
-	}
-
-	ret = rte_eth_dev_configure(vf_port,
-				    dev->data->nb_rx_queues,
-				    dev->data->nb_tx_queues,
-				    &vf_conf);
-	if (ret) {
-		PMD_DRV_LOG(ERR,
-			    "VF configuration failed: %d", ret);
-	} else if (vf_conf.intr_conf.lsc) {
-		ret = rte_eth_dev_callback_register(vf_port,
-						    RTE_ETH_DEV_INTR_LSC,
-						    hn_vf_lsc_event, dev);
-		if (ret)
-			PMD_DRV_LOG(ERR,
-				    "Failed to register LSC callback for VF %u",
-				    vf_port);
-	}
-	return ret;
-}
-
 /*
  * Configure VF if present.
  * Force VF to have same number of queues as synthetic device
@@ -305,11 +224,22 @@ int hn_vf_configure(struct rte_eth_dev *dev,
 		    const struct rte_eth_conf *dev_conf)
 {
 	struct hn_data *hv = dev->data->dev_private;
+	struct rte_eth_conf vf_conf = *dev_conf;
 	int ret = 0;
 
+	/* link state interrupt does not matter here. */
+	vf_conf.intr_conf.lsc = 0;
+
 	rte_rwlock_read_lock(&hv->vf_lock);
-	if (hv->vf_port != HN_INVALID_PORT)
-		ret = _hn_vf_configure(dev, hv->vf_port, dev_conf);
+	if (hv->vf_port != HN_INVALID_PORT) {
+		ret = rte_eth_dev_configure(hv->vf_port,
+					    dev->data->nb_rx_queues,
+					    dev->data->nb_tx_queues,
+					    &vf_conf);
+		if (ret != 0)
+			PMD_DRV_LOG(ERR,
+				    "VF configuration failed: %d", ret);
+	}
 	rte_rwlock_read_unlock(&hv->vf_lock);
 	return ret;
 }
-- 
2.26.2


  parent reply	other threads:[~2020-05-19 16:53 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-06 19:27 [dpdk-dev] [PATCH 0/4] net/netvsc: diagnostic enhancements Stephen Hemminger
2020-05-06 19:27 ` [dpdk-dev] [PATCH 1/4] net/netvsc: support per-queue info requests Stephen Hemminger
2020-05-06 19:27 ` [dpdk-dev] [PATCH 2/4] net/netvsc: implement rx/tx descriptor status functions Stephen Hemminger
2020-05-06 19:27 ` [dpdk-dev] [PATCH 3/4] net/netvsc: change tx/rx error handling Stephen Hemminger
2020-05-06 19:27 ` [dpdk-dev] [PATCH 4/4] bus/vmbus: improve debug output Stephen Hemminger
2020-05-06 19:52 ` [dpdk-dev] [PATCH v2 0/4] net/netvsc: diagnostic enhancements Stephen Hemminger
2020-05-06 19:52   ` [dpdk-dev] [PATCH v2 1/4] net/netvsc: support per-queue info requests Stephen Hemminger
2020-05-06 19:52   ` [dpdk-dev] [PATCH v2 2/4] net/netvsc: implement rx/tx descriptor status functions Stephen Hemminger
2020-05-07 15:27     ` Ferruh Yigit
2020-05-06 19:52   ` [dpdk-dev] [PATCH v2 3/4] net/netvsc: change tx/rx error handling Stephen Hemminger
2020-05-07 15:29     ` Ferruh Yigit
2020-05-06 19:52   ` [dpdk-dev] [PATCH v2 4/4] bus/vmbus: improve debug output Stephen Hemminger
2020-05-19 16:52 ` [dpdk-dev] [PATCH v3 0/7] net/netvsc: VF bug fix and diagnostic support Stephen Hemminger
2020-05-19 16:52   ` [dpdk-dev] [PATCH v3 1/7] net/netvsc: support per-queue info requests Stephen Hemminger
2020-05-19 16:52   ` [dpdk-dev] [PATCH v3 2/7] net/netvsc: implement rx/tx descriptor status functions Stephen Hemminger
2020-05-27 18:14     ` Ferruh Yigit
2020-05-27 21:00       ` Stephen Hemminger
2020-05-19 16:52   ` [dpdk-dev] [PATCH v3 3/7] net/netvsc: change tx/rx logging Stephen Hemminger
2020-05-19 16:52   ` [dpdk-dev] [PATCH v3 4/7] net/netvsc: fix warning when VF is removed Stephen Hemminger
2020-05-19 16:52   ` Stephen Hemminger [this message]
2020-05-19 16:52   ` [dpdk-dev] [PATCH v3 6/7] net/netvsc: process link change messages in alarm Stephen Hemminger
2020-05-19 16:52   ` [dpdk-dev] [PATCH v3 7/7] net/netvsc: do not spin forever waiting for reply Stephen Hemminger
2020-05-27 18:16   ` [dpdk-dev] [PATCH v3 0/7] net/netvsc: VF bug fix and diagnostic support Ferruh Yigit

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=20200519165230.23306-6-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    /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).