diff options
author | Stephen Hemminger <stephen@networkplumber.org> | 2017-06-25 22:30:27 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-10-21 18:55:07 +0300 |
commit | 27ba39f28808d6e983ad028da15952f29918a6c4 (patch) | |
tree | 1b8f7214bdc21835106fafdada013624ec2bfff8 /drivers | |
parent | df95afa5960b806835f2fa4d167a828d9329ba87 (diff) | |
download | linux-27ba39f28808d6e983ad028da15952f29918a6c4.tar.xz |
vmbus: eliminate duplicate cached index
commit 05d00bc94ac27d220d8a78e365d7fa3a26dcca17 upstream.
Don't need cached read index anymore now that packet iterator
is used. The iterator has the original read index until the
visible read_index is updated.
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hv/ring_buffer.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index a9021f13379f..b0f79526b86a 100644 --- a/drivers/hv/ring_buffer.c +++ b/drivers/hv/ring_buffer.c @@ -358,9 +358,6 @@ struct vmpacket_descriptor *hv_pkt_iter_first(struct vmbus_channel *channel) { struct hv_ring_buffer_info *rbi = &channel->inbound; - /* set state for later hv_pkt_iter_close */ - rbi->cached_read_index = rbi->ring_buffer->read_index; - if (hv_pkt_iter_avail(rbi) < sizeof(struct vmpacket_descriptor)) return NULL; @@ -388,10 +385,7 @@ __hv_pkt_iter_next(struct vmbus_channel *channel, rbi->priv_read_index -= dsize; /* more data? */ - if (hv_pkt_iter_avail(rbi) < sizeof(struct vmpacket_descriptor)) - return NULL; - else - return hv_get_ring_buffer(rbi) + rbi->priv_read_index; + return hv_pkt_iter_first(channel); } EXPORT_SYMBOL_GPL(__hv_pkt_iter_next); @@ -401,7 +395,7 @@ EXPORT_SYMBOL_GPL(__hv_pkt_iter_next); void hv_pkt_iter_close(struct vmbus_channel *channel) { struct hv_ring_buffer_info *rbi = &channel->inbound; - u32 cur_write_sz, cached_write_sz; + u32 orig_write_sz = hv_get_bytes_to_write(rbi); u32 pending_sz; /* @@ -430,13 +424,10 @@ void hv_pkt_iter_close(struct vmbus_channel *channel) if (pending_sz == 0) return; - cur_write_sz = hv_get_bytes_to_write(rbi); - - if (cur_write_sz < pending_sz) + if (hv_get_bytes_to_write(rbi) < pending_sz) return; - cached_write_sz = hv_get_cached_bytes_to_write(rbi); - if (cached_write_sz < pending_sz) + if (orig_write_sz < pending_sz) vmbus_setevent(channel); } EXPORT_SYMBOL_GPL(hv_pkt_iter_close); |