]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
DnD performance tuning for Mac and Windows clients; not directly applicable
authorOliver Kurth <okurth@vmware.com>
Thu, 28 Mar 2019 19:43:00 +0000 (12:43 -0700)
committerOliver Kurth <okurth@vmware.com>
Thu, 28 Mar 2019 19:43:00 +0000 (12:43 -0700)
to open-vm-tools.

open-vm-tools/services/plugins/dndcp/dnd/dnd.h
open-vm-tools/services/plugins/dndcp/dnd/dndCPMsgV4.c
open-vm-tools/services/plugins/dndcp/dnd/dndCPMsgV4.h
open-vm-tools/services/plugins/dndcp/dnd/dndRpcV4.hh
open-vm-tools/services/plugins/dndcp/dndGuest/dndRpcV4.cc
open-vm-tools/services/plugins/dndcp/dndGuest/rpcV4Util.cpp
open-vm-tools/services/plugins/dndcp/dndGuest/rpcV4Util.hpp

index db8d2b144fdc169ab076be0d78604fceac51a4c6..f439eb6ec5e9b1385413e4d9a1c5c81cb8e0bf44 100644 (file)
@@ -201,11 +201,11 @@ typedef struct DnDTransportBuffer {
 #define DND_TRANSPORT_PACKET_HEADER_SIZE      (5 * sizeof(uint32))
 #ifdef VMX86_HORIZON_VIEW
 /*
- * For Horizon DnD, expand the message size to almost 1M, which is the
- * mkscontrol message limitation. Leave 100 bytes for mkscontrol message
- * overhead (message header + length of message name)
+ * For Horizon DnD, expand the message size to almost 16M, which provides
+ * better DnD Performance on text/rich text/image etc. dragging and dropping
+ * per current performance tuning.
  */
-#define DND_MAX_TRANSPORT_PACKET_SIZE         ((1 << 20) - 100)
+#define DND_MAX_TRANSPORT_PACKET_SIZE         ((1 << 24) - 100)
 #else
 /* Close to 64k (maximum guestRpc message size). Leave some space for guestRpc header. */
 #define DND_MAX_TRANSPORT_PACKET_SIZE         ((1 << 16) - 100)
index 39b2638a2992d84b0cc68448c0efbaa17ba3ff9f..e146e5141057a7d1f457139183ab5c53406679be 100644 (file)
@@ -167,6 +167,17 @@ Bool
 DnDCPMsgV4_Serialize(DnDCPMsgV4 *msg,
                      uint8 **packet,
                      size_t *packetSize)
+{
+   return DnDCPMsgV4_SerializeWithInputPayloadSizeCheck(
+      msg, packet, packetSize, DND_CP_PACKET_MAX_PAYLOAD_SIZE_V4);
+}
+
+
+Bool
+DnDCPMsgV4_SerializeWithInputPayloadSizeCheck(DnDCPMsgV4 *msg,
+                                              uint8 **packet,
+                                              size_t *packetSize,
+                                              const uint32 maxPacketPayloadSize)
 {
    size_t payloadSize = 0;
 
@@ -175,7 +186,7 @@ DnDCPMsgV4_Serialize(DnDCPMsgV4 *msg,
    ASSERT(packetSize);
    ASSERT(msg->hdr.binarySize >= msg->hdr.payloadOffset);
 
-   if (msg->hdr.binarySize <= DND_CP_PACKET_MAX_PAYLOAD_SIZE_V4) {
+   if (msg->hdr.binarySize <= maxPacketPayloadSize) {
       /*
        * One single packet is enough for the message. For short message, the
        * payloadOffset should always be 0.
@@ -184,8 +195,8 @@ DnDCPMsgV4_Serialize(DnDCPMsgV4 *msg,
       payloadSize = msg->hdr.binarySize;
    } else {
       /* For big message, payloadOffset means binary size we already sent out. */
-      if (msg->hdr.binarySize - msg->hdr.payloadOffset > DND_CP_PACKET_MAX_PAYLOAD_SIZE_V4) {
-         payloadSize = DND_CP_PACKET_MAX_PAYLOAD_SIZE_V4;
+      if (msg->hdr.binarySize - msg->hdr.payloadOffset > maxPacketPayloadSize) {
+         payloadSize = maxPacketPayloadSize;
       } else {
          payloadSize = msg->hdr.binarySize - msg->hdr.payloadOffset;
       }
index bd4fc94b6319a37b6bc7422041b22e424b744888..5d3ef7826ca03d73593b14ca2581565ad9989fa7 100644 (file)
@@ -244,6 +244,8 @@ DnDCPMsgPacketType DnDCPMsgV4_GetPacketType(const uint8 *packet,
 Bool DnDCPMsgV4_Serialize(DnDCPMsgV4 *msg,
                           uint8 **packet,
                           size_t *packetSize);
+Bool DnDCPMsgV4_SerializeWithInputPayloadSizeCheck(DnDCPMsgV4 *msg,
+   uint8 **packet, size_t *packetSize, const uint32 maxPacketPayloadSize);
 Bool DnDCPMsgV4_UnserializeSingle(DnDCPMsgV4 *msg,
                                   const uint8 *packet,
                                   size_t packetSize);
index 0d4bcf1167c327ce4e6c2f0114c017b57e0a8cc7..46e8b27d3240d5bed4451a71845436cdec679f5d 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2010-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 2010-2019 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -103,6 +103,8 @@ public:
    void AddRpcSentListener(DnDRpcListener *obj);
    void RemoveRpcSentListener(DnDRpcListener *obj);
 
+   void SetMaxTransportPacketSize(const uint32 size);
+
 private:
    DnDCPTransport *mTransport;
    TransportInterfaceType mTransportInterface;
index 59d637e5c71554d058df93470ef5f1dd33cbb11c..822af80dd3a3264a31ed405704b7997c35124456 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2010-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 2010-2019 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -836,3 +836,16 @@ DnDRpcV4::RemoveRpcSentListener(DnDRpcListener *obj)
 {
    mUtil.RemoveRpcSentListener(obj);
 }
+
+
+/**
+ * Set the max transport packet size of RPC messages.
+ *
+ * @param[in] size the new max packet size.
+ */
+
+void
+DnDRpcV4::SetMaxTransportPacketSize(const uint32 size)
+{
+   mUtil.SetMaxTransportPacketSize(size);
+}
index 60ee08996ec808c6803948d9bb92cf3b1cedddaa..cca5d9ed7fef62ff3b05e1636f41763499a65009 100644 (file)
@@ -53,7 +53,8 @@ extern "C" {
 
 RpcV4Util::RpcV4Util(void)
    : mVersionMajor(4),
-     mVersionMinor(0)
+     mVersionMinor(0),
+     mMaxTransportPacketPayloadSize(DND_CP_PACKET_MAX_PAYLOAD_SIZE_V4)
 {
    DnDCPMsgV4_Init(&mBigMsgIn);
    DnDCPMsgV4_Init(&mBigMsgOut);
@@ -177,7 +178,7 @@ RpcV4Util::SendMsg(RpcParams *params,
 
    DnDCPMsgV4_Init(&shortMsg);
 
-   if (binarySize > DND_CP_PACKET_MAX_PAYLOAD_SIZE_V4) {
+   if (binarySize > mMaxTransportPacketPayloadSize) {
       /*
        * For big message, all information should be cached in mBigMsgOut
        * because multiple packets and sends are needed.
@@ -335,7 +336,8 @@ RpcV4Util::SendMsg(DnDCPMsgV4 *msg)
    size_t packetSize = 0;
    bool ret = false;
 
-   if (!DnDCPMsgV4_Serialize(msg, &packet, &packetSize)) {
+   if (!DnDCPMsgV4_SerializeWithInputPayloadSizeCheck(msg, &packet,
+      &packetSize, mMaxTransportPacketPayloadSize)) {
       LOG(1, ("%s: DnDCPMsgV4_Serialize failed. \n", __FUNCTION__));
       return false;
    }
@@ -364,7 +366,12 @@ RpcV4Util::OnRecvPacket(uint32 srcId,
                         const uint8 *packet,
                         size_t packetSize)
 {
-   DnDCPMsgPacketType packetType = DnDCPMsgV4_GetPacketType(packet, packetSize);
+   DnDCPMsgPacketType packetType = DND_CP_MSG_PACKET_TYPE_INVALID;
+
+   if (packetSize <= mMaxTransportPacketPayloadSize + DND_CP_MSG_HEADERSIZE_V4) {
+      packetType = DnDCPMsgV4_GetPacketType(packet, packetSize);
+   }
+
    switch (packetType) {
    case DND_CP_MSG_PACKET_TYPE_SINGLE:
       HandlePacket(srcId, packet, packetSize);
@@ -665,4 +672,27 @@ RpcV4Util::FireRpcSentCallbacks(uint32 cmd,
 }
 
 
+/**
+ * Set the max transport packet size of RPC messages.
+ *
+ * @param[in] size the new max packet size.
+ */
+
+void
+RpcV4Util::SetMaxTransportPacketSize(const uint32 size)
+{
+   ASSERT(size > DND_CP_MSG_HEADERSIZE_V4);
+
+   uint32 newProposedPayloadSize = size - DND_CP_MSG_HEADERSIZE_V4;
+   if (newProposedPayloadSize < DND_CP_PACKET_MAX_PAYLOAD_SIZE_V4) {
+      /*
+       * Reset the max transport packet payload size
+       * if the new size is stricter than the default one.
+       */
+      mMaxTransportPacketPayloadSize = newProposedPayloadSize;
+      LOG(1, ("%s: The packet size is set to %u. \n", __FUNCTION__,
+              mMaxTransportPacketPayloadSize));
+   }
+}
+
 
index 7f978d6c631488773b6c7062c052ba244258896b..6e38a75d0cd2495f7b1ede7aa50c509d2297ef1c 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2010-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 2010-2019 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -84,6 +84,8 @@ public:
    bool AddRpcSentListener(const DnDRpcListener *obj);
    bool RemoveRpcSentListener(const DnDRpcListener *obj);
 
+   void SetMaxTransportPacketSize(const uint32 size);
+
 private:
    void FireRpcReceivedCallbacks(uint32 cmd, uint32 src, uint32 session);
    void FireRpcSentCallbacks(uint32 cmd, uint32 dest, uint32 session);
@@ -107,6 +109,7 @@ private:
    uint32 mMsgSrc;
    DblLnkLst_Links mRpcSentListeners;
    DblLnkLst_Links mRpcReceivedListeners;
+   uint32 mMaxTransportPacketPayloadSize;
 };
 
 #endif // RPC_V4_UTIL_HPP