Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752815AbdCEB3z (ORCPT ); Sat, 4 Mar 2017 20:29:55 -0500 Received: from a2nlsmtp01-04.prod.iad2.secureserver.net ([198.71.225.38]:36170 "EHLO a2nlsmtp01-04.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752457AbdCEB27 (ORCPT ); Sat, 4 Mar 2017 20:28:59 -0500 x-originating-ip: 107.180.71.197 From: kys@exchange.microsoft.com To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, jasowang@redhat.com, leann.ogasawara@canonical.com, marcelo.cerri@canonical.com Cc: Stephen Hemminger , Stephen Hemminger , "K. Y. Srinivasan" Subject: [PATCH 9/9] vmbus: expose debug info for drivers Date: Sat, 4 Mar 2017 18:27:18 -0700 Message-Id: <1488677238-5150-9-git-send-email-kys@exchange.microsoft.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1488677204-5059-1-git-send-email-kys@exchange.microsoft.com> References: <1488677204-5059-1-git-send-email-kys@exchange.microsoft.com> Reply-To: kys@microsoft.com X-CMAE-Envelope: MS4wfHBlwDg9FQIpfTLSx5TV4MDdkUyNNuPriDWi2WuAy1PcMvQD6vUdrqrN4rxS23tMB/a3KeGDCdpBTxbXp+yPWzULlRTnHVVJ2Ad4zCQ6+bvJwej+SOJu cdWXnXHYFUPLiITNtYS9CBGu9w9OJUn/k6V7X2dCgK1PDZuUsGSZ4O6fZJIdPERPh1lN7mjDvpotV+DRHiY7WdP/+qRCUrEMLx3/aqy2hsAK64xl/FRPUa3a +pHcwbM66MmHR86N2QZFrau0NZaVea3+0McVVyhSNBT+TPNQsmptX4NntUVD6+v/7oPQNl5Lrg0R/Iy/jocLZHnSbSIw2E5ZswuGvsbJhTOX7+Exp4+ATOk7 68YbT8GYFQl8eX3Nwr7Py/NKUdNVBVVYlubbwFsjwQVIcnaRjLoztQ8o262i0K6aG1INOOgw84uO6bjbF3O1bTfyixUeUsKu+5ZaApEMzaeBMtDXx5hqYgaO TxJy0NCjH0KqXgjkVORoMgFMXFTHnJI38SrmAJ8dFEJAPtxQTJ0s54aW9IU4xVVCiNcZgbDXTG9sDo7hNhU9iL+S/QAqG1IrujHNNA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2916 Lines: 90 From: Stephen Hemminger Allow driver to get debug information about state of the ring. Signed-off-by: Stephen Hemminger Signed-off-by: K. Y. Srinivasan --- drivers/hv/hyperv_vmbus.h | 11 ----------- drivers/hv/ring_buffer.c | 1 + include/linux/hyperv.h | 17 +++++++++++++++++ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h index a69b52d..6113e91 100644 --- a/drivers/hv/hyperv_vmbus.h +++ b/drivers/hv/hyperv_vmbus.h @@ -248,14 +248,6 @@ struct hv_context { extern struct hv_context hv_context; -struct hv_ring_buffer_debug_info { - u32 current_interrupt_mask; - u32 current_read_index; - u32 current_write_index; - u32 bytes_avail_toread; - u32 bytes_avail_towrite; -}; - /* Hv Interface */ extern int hv_init(void); @@ -289,9 +281,6 @@ int hv_ringbuffer_read(struct vmbus_channel *channel, void *buffer, u32 buflen, u32 *buffer_actual_len, u64 *requestid, bool raw); -void hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info *ring_info, - struct hv_ring_buffer_debug_info *debug_info); - /* * Maximum channels is determined by the size of the interrupt page * which is PAGE_SIZE. 1/2 of PAGE_SIZE is for send endpoint interrupt diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index 8a24974..cfacca5 100644 --- a/drivers/hv/ring_buffer.c +++ b/drivers/hv/ring_buffer.c @@ -206,6 +206,7 @@ void hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info *ring_info, ring_info->ring_buffer->interrupt_mask; } } +EXPORT_SYMBOL_GPL(hv_ringbuffer_get_debuginfo); /* Initialize the ring buffer. */ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info, diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 02f5d76..f681f7b 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -491,6 +491,12 @@ struct vmbus_channel_rescind_offer { u32 child_relid; } __packed; +static inline u32 +hv_ringbuffer_pending_size(const struct hv_ring_buffer_info *rbi) +{ + return rbi->ring_buffer->pending_send_sz; +} + /* * Request Offer -- no parameters, SynIC message contains the partition ID * Set Snoop -- no parameters, SynIC message contains the partition ID @@ -1155,6 +1161,17 @@ static inline void hv_set_drvdata(struct hv_device *dev, void *data) return dev_get_drvdata(&dev->device); } +struct hv_ring_buffer_debug_info { + u32 current_interrupt_mask; + u32 current_read_index; + u32 current_write_index; + u32 bytes_avail_toread; + u32 bytes_avail_towrite; +}; + +void hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info *ring_info, + struct hv_ring_buffer_debug_info *debug_info); + /* Vmbus interface */ #define vmbus_driver_register(driver) \ __vmbus_driver_register(driver, THIS_MODULE, KBUILD_MODNAME) -- 1.7.1