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>,
	Stephen Hemminger <sthemmin@microsoft.com>
Subject: [dpdk-dev] [PATCH 2/4] bus/vmbus: add host latency tuning function
Date: Thu,  9 Aug 2018 10:50:06 -0700	[thread overview]
Message-ID: <20180809175008.5787-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20180809175008.5787-1-stephen@networkplumber.org>

Add vmbus API to allow tuning the scan interval on the host side.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
---
 drivers/bus/vmbus/rte_bus_vmbus.h           | 15 ++++++++++++
 drivers/bus/vmbus/rte_bus_vmbus_version.map |  1 +
 drivers/bus/vmbus/vmbus_channel.c           | 26 +++++++++++++++++++++
 3 files changed, 42 insertions(+)

diff --git a/drivers/bus/vmbus/rte_bus_vmbus.h b/drivers/bus/vmbus/rte_bus_vmbus.h
index 4a2c1f6fd918..2839fef5b27a 100644
--- a/drivers/bus/vmbus/rte_bus_vmbus.h
+++ b/drivers/bus/vmbus/rte_bus_vmbus.h
@@ -364,6 +364,21 @@ void rte_vmbus_chan_signal_read(struct vmbus_channel *chan, uint32_t bytes_read)
  */
 uint16_t rte_vmbus_sub_channel_index(const struct vmbus_channel *chan);
 
+/**
+ * Set the host monitor latency hint
+ *
+ * @param dev
+ *    VMBUS device
+ * @param chan
+ *	Pointer to vmbus_channel structure.
+ * @param latency
+ *	Approximate wait period between hypervisor examinations of
+ *	the trigger page (in nanoseconds).
+ */
+void rte_vmbus_set_latency(const struct rte_vmbus_device *dev,
+			   const struct vmbus_channel *chan,
+			   uint32_t latency);
+
 /**
  * Register a VMBUS driver.
  *
diff --git a/drivers/bus/vmbus/rte_bus_vmbus_version.map b/drivers/bus/vmbus/rte_bus_vmbus_version.map
index dabb9203104b..5b01ff30d7b0 100644
--- a/drivers/bus/vmbus/rte_bus_vmbus_version.map
+++ b/drivers/bus/vmbus/rte_bus_vmbus_version.map
@@ -20,6 +20,7 @@ DPDK_18.08 {
 	rte_vmbus_probe;
 	rte_vmbus_register;
 	rte_vmbus_scan;
+	rte_vmbus_set_latency;
 	rte_vmbus_sub_channel_index;
 	rte_vmbus_subchan_open;
 	rte_vmbus_unmap_device;
diff --git a/drivers/bus/vmbus/vmbus_channel.c b/drivers/bus/vmbus/vmbus_channel.c
index cc5f3e8379a5..bd14c0662b46 100644
--- a/drivers/bus/vmbus/vmbus_channel.c
+++ b/drivers/bus/vmbus/vmbus_channel.c
@@ -59,6 +59,32 @@ vmbus_set_event(const struct rte_vmbus_device *dev,
 	vmbus_set_monitor(dev, chan->monitor_id);
 }
 
+/*
+ * Set the wait between when hypervisor examines the trigger.
+ */
+void
+rte_vmbus_set_latency(const struct rte_vmbus_device *dev,
+		      const struct vmbus_channel *chan,
+		      uint32_t latency)
+{
+	uint32_t trig_idx = chan->monitor_id / VMBUS_MONTRIG_LEN;
+	uint32_t trig_offs = chan->monitor_id % VMBUS_MONTRIG_LEN;
+
+	if (latency >= UINT16_MAX * 100) {
+		VMBUS_LOG(ERR, "invalid latency value %u", latency);
+		return;
+	}
+
+	if (trig_idx >= VMBUS_MONTRIGS_MAX) {
+		VMBUS_LOG(ERR, "invalid monitor trigger %u",
+			  trig_idx);
+		return;
+	}
+
+	/* Host value is expressed in 100 nanosecond units */
+	dev->monitor_page->lat[trig_idx][trig_offs] = latency / 100;
+}
+
 /*
  * Notify host that there are data pending on our TX bufring.
  *
-- 
2.18.0

  parent reply	other threads:[~2018-08-09 17:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09 17:50 [dpdk-dev] [PATCH 0/4] netvsc performance enhancements Stephen Hemminger
2018-08-09 17:50 ` [dpdk-dev] [PATCH 1/4] netvsc: chimney buffer size error handling Stephen Hemminger
2018-08-23 14:45   ` Ferruh Yigit
2018-08-23 15:38     ` Stephen Hemminger
2018-08-09 17:50 ` Stephen Hemminger [this message]
2018-08-23 14:45   ` [dpdk-dev] [PATCH 2/4] bus/vmbus: add host latency tuning function Ferruh Yigit
2018-08-23 15:40     ` Stephen Hemminger
2018-08-09 17:50 ` [dpdk-dev] [PATCH 3/4] netvsc: set lower host latency Stephen Hemminger
2018-08-09 17:50 ` [dpdk-dev] [PATCH 4/4] netvsc: implement tx_done_cleanup Stephen Hemminger
2018-08-23 14:46   ` Ferruh Yigit
2018-08-23 14:47 ` [dpdk-dev] [PATCH 0/4] netvsc performance enhancements 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=20180809175008.5787-3-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=sthemmin@microsoft.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).