]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Optimize send and receive on VMX vSockets.
authorVMware, Inc <>
Fri, 12 Apr 2013 19:55:15 +0000 (12:55 -0700)
committerDmitry Torokhov <dtor@vmware.com>
Wed, 17 Apr 2013 19:16:56 +0000 (12:16 -0700)
Skip a lot of extraneous logic in VSockSocket_Send and VSockSocket_Recv
by using vmci_qpair_enqueue and vmci_qpair_dequeue directly. This is the
same idea as what happens on Mac OS X when data is copied into the host
pipe in VSockOS_HandleStreamRecv. This allows us to copy data out of the
queue pair as quickly as possible and flush send buffers into the queue
pair without waiting for a callback on the poll thread. Client callbacks
must still be fired on the poll thread to preserve the AsyncSocket API.

Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
open-vm-tools/lib/asyncsocket/asyncsocket.c

index 8375c8c452a06fc65eeaa7894367553641a7ce32..db6c1ad2cadbd4bd36bde80416318642231a2afc 100644 (file)
@@ -2654,6 +2654,10 @@ AsyncSocketCheckAndDispatchRecv(AsyncSocket *s,  // IN
 {
    ASSERT(s);
    ASSERT(result);
+   ASSERT(s->recvFn);
+   ASSERT(s->recvBuf);
+   ASSERT(s->recvLen > 0);
+   ASSERT(s->recvPos <= s->recvLen);
 
    if (s->recvPos == s->recvLen || s->recvFireOnPartial) {
       void *recvBuf = s->recvBuf;