From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by dpdk.org (Postfix) with ESMTP id 1133D2BCD for ; Thu, 9 Aug 2018 19:50:21 +0200 (CEST) Received: by mail-pg1-f194.google.com with SMTP id w10-v6so3099202pgv.2 for ; Thu, 09 Aug 2018 10:50:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=naiS10gSZtfmF3kVjCxn/koiL4XuWWzSvx7Re+7HG0Q=; b=0VBFERMW23r1D2jy2pILfO7bynM6iKrcTg/Y1e4kdw5AhdLPOuI2N93OOPIbeQfNLx Z8EvKVUdKk73AY5/jvXGSK1Y7xTFouRt4AuqzUS6hxilVclfor+Y7d0kP/HGPwuUgib/ n+EHB/D8OF49NkPsZKupZywXEk13tGQ+ZxFixpxsgk+z3rDVsZCgGyFZl8Vjds2dGcEc 8vpVfmlxU9+LQBRYf9NOnwFkP2Tocygxs0Bu5vczaNfvrMV3jaIMGqni+dgRp0DXDv9N DahDeFrnuhHieXC+Q6M8cLRjwCsDIggd4S07VIBIsIsP4SCFEYE+phMm+TMA08ji9gBe aouw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=naiS10gSZtfmF3kVjCxn/koiL4XuWWzSvx7Re+7HG0Q=; b=BP13ZoNK1J0rtnzeLejNK9nJnouJVnl7A98ytkufct/NIvnvXdeNTHIKUGv+9o+Y1D JL/nhV/UGYb0mSaIjgAnGTYSP958c2GgrULiESWcksVnK2ywk0CtVlO7lByLWfjWETav aJPXIob4k6e5jF/HSWN8gWsTOZDjRMeW2JPiOtq+C9JRgCcA2j7uVGMJOCphuc3VLpHs WrPdrK126iamr6V4lXf51Z+y2pwG04NjP6oRITIbhy5HpsWDIQyx41G305/49dI5itgk 7GV9nEqE85beJiL28w6wnzB2SM6AsPNvlL3/zZ+92J4vPSWaAwgmQTa5OYcb9icpWw+7 vEWg== X-Gm-Message-State: AOUpUlFm5RSlelqQW95mLlh89ykG0D7XmO+8+DBC1ls1EjVAxVIbvuu2 h1ZE+ZPinB+lZolHirC5CAmEyV2Ov4k= X-Google-Smtp-Source: AA+uWPwU2qjZKJwOzZ3izHzi/iolYxEYD/r+jkNWGhAcaW9k2Qq+yChOJipX4LGEOWD5JFdmYMmY+A== X-Received: by 2002:a62:be03:: with SMTP id l3-v6mr3383741pff.138.1533837019934; Thu, 09 Aug 2018 10:50:19 -0700 (PDT) Received: from xeon-e3.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id n22-v6sm14993873pfj.68.2018.08.09.10.50.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Aug 2018 10:50:18 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Stephen Hemminger Date: Thu, 9 Aug 2018 10:50:06 -0700 Message-Id: <20180809175008.5787-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180809175008.5787-1-stephen@networkplumber.org> References: <20180809175008.5787-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH 2/4] bus/vmbus: add host latency tuning function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2018 17:50:21 -0000 Add vmbus API to allow tuning the scan interval on the host side. Signed-off-by: Stephen Hemminger --- 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