Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F81969416
D8611.id22428.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D8611.id22428.diff
View Options
Index: sys/dev/hyperv/include/vmbus.h
===================================================================
--- sys/dev/hyperv/include/vmbus.h
+++ sys/dev/hyperv/include/vmbus.h
@@ -116,6 +116,7 @@
};
struct vmbus_channel;
+struct vmbus_xact;
struct vmbus_xact_ctx;
struct hyperv_guid;
struct task;
@@ -173,6 +174,8 @@
void vmbus_chan_set_orphan(struct vmbus_channel *chan,
struct vmbus_xact_ctx *);
void vmbus_chan_unset_orphan(struct vmbus_channel *chan);
+const void *vmbus_chan_xact_wait(const struct vmbus_channel *chan,
+ struct vmbus_xact *xact, size_t *resp_len, bool can_sleep);
int vmbus_chan_gpadl_connect(struct vmbus_channel *chan,
bus_addr_t paddr, int size, uint32_t *gpadl);
Index: sys/dev/hyperv/vmbus/vmbus_chan.c
===================================================================
--- sys/dev/hyperv/vmbus/vmbus_chan.c
+++ sys/dev/hyperv/vmbus/vmbus_chan.c
@@ -1927,3 +1927,37 @@
chan->ch_orphan_xact = NULL;
sx_xunlock(&chan->ch_orphan_lock);
}
+
+const void *
+vmbus_chan_xact_wait(const struct vmbus_channel *chan,
+ struct vmbus_xact *xact, size_t *resp_len, bool can_sleep)
+{
+ const void *ret;
+
+ if (can_sleep)
+ ret = vmbus_xact_wait(xact, resp_len);
+ else
+ ret = vmbus_xact_busywait(xact, resp_len);
+ if (vmbus_chan_is_revoked(chan)) {
+ /*
+ * This xact probably is interrupted, and the
+ * interruption can race the reply reception,
+ * so we have to make sure that there are nothing
+ * left on the RX bufring, i.e. this xact will
+ * not be touched, once this function returns.
+ *
+ * Since the hypervisor will not put more data
+ * onto the RX bufring once the channel is revoked,
+ * the following loop will be terminated, once all
+ * data are drained by the driver's channel
+ * callback.
+ */
+ while (!vmbus_chan_rx_empty(chan)) {
+ if (can_sleep)
+ pause("chxact", 1);
+ else
+ DELAY(1000);
+ }
+ }
+ return (ret);
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 15, 6:35 AM (8 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
9091496
Default Alt Text
D8611.id22428.diff (1 KB)
Attached To
Mode
D8611: hyperv/vmbus: Add supportive transaction wait function.
Attached
Detach File
Event Timeline
Log In to Comment