Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 03bad714 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Greg Kroah-Hartman
Browse files

vmbus: more host signalling avoidance



Don't signal host if it has disabled interrupts for that
ring buffer. Check the feature bit to see if host supports
pending send size flag.

Signed-off-by: default avatarStephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 05d00bc9
Loading
Loading
Loading
Loading
+19 −8
Original line number Diff line number Diff line
@@ -396,7 +396,6 @@ void hv_pkt_iter_close(struct vmbus_channel *channel)
{
	struct hv_ring_buffer_info *rbi = &channel->inbound;
	u32 orig_write_sz = hv_get_bytes_to_write(rbi);
	u32 pending_sz;

	/*
	 * Make sure all reads are done before we update the read index since
@@ -419,15 +418,27 @@ void hv_pkt_iter_close(struct vmbus_channel *channel)
	 */
	virt_mb();

	pending_sz = READ_ONCE(rbi->ring_buffer->pending_send_sz);
	/* If the other end is not blocked on write don't bother. */
	if (pending_sz == 0)
	/* If host has disabled notifications then skip */
	if (rbi->ring_buffer->interrupt_mask)
		return;

	if (rbi->ring_buffer->feature_bits.feat_pending_send_sz) {
		u32 pending_sz = READ_ONCE(rbi->ring_buffer->pending_send_sz);

		/*
		 * If there was space before we began iteration,
		 * then host was not blocked. Also handles case where
		 * pending_sz is zero then host has nothing pending
		 * and does not need to be signaled.
		 */
		if (orig_write_sz > pending_sz)
			return;

		/* If pending write will not fit, don't give false hope. */
		if (hv_get_bytes_to_write(rbi) < pending_sz)
			return;
	}

	if (orig_write_sz < pending_sz)
	vmbus_setevent(channel);
}
EXPORT_SYMBOL_GPL(hv_pkt_iter_close);