to open-vm-tools.
#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)
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;
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.
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;
}
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);
/*********************************************************
- * 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
void AddRpcSentListener(DnDRpcListener *obj);
void RemoveRpcSentListener(DnDRpcListener *obj);
+ void SetMaxTransportPacketSize(const uint32 size);
+
private:
DnDCPTransport *mTransport;
TransportInterfaceType mTransportInterface;
/*********************************************************
- * 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
{
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);
+}
RpcV4Util::RpcV4Util(void)
: mVersionMajor(4),
- mVersionMinor(0)
+ mVersionMinor(0),
+ mMaxTransportPacketPayloadSize(DND_CP_PACKET_MAX_PAYLOAD_SIZE_V4)
{
DnDCPMsgV4_Init(&mBigMsgIn);
DnDCPMsgV4_Init(&mBigMsgOut);
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.
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;
}
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);
}
+/**
+ * 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));
+ }
+}
+
/*********************************************************
- * 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
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);
uint32 mMsgSrc;
DblLnkLst_Links mRpcSentListeners;
DblLnkLst_Links mRpcReceivedListeners;
+ uint32 mMaxTransportPacketPayloadSize;
};
#endif // RPC_V4_UTIL_HPP