From: VMware, Inc <> Date: Thu, 2 Aug 2012 06:48:30 +0000 (-0700) Subject: vmballoon: cleanup and optimization X-Git-Tag: 2012.10.14-874563~71 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e8d6ad9898a0cff1a86d153be22f84a59bbb0fd0;p=thirdparty%2Fopen-vm-tools.git vmballoon: cleanup and optimization * Instead of using a new command to report the protocol to be used by the guest, use the register ECX in the START command. * Instead of using the protocol v2 when RR FT can be enabled, detect that FT has been enabled and request a reset from the guest. Signed-off-by: Dmitry Torokhov --- diff --git a/open-vm-tools/modules/shared/vmmemctl/backdoor_balloon.c b/open-vm-tools/modules/shared/vmmemctl/backdoor_balloon.c index def135c9e..d511c7a2e 100644 --- a/open-vm-tools/modules/shared/vmmemctl/backdoor_balloon.c +++ b/open-vm-tools/modules/shared/vmmemctl/backdoor_balloon.c @@ -86,47 +86,6 @@ void BackdoorBalloon(Backdoor_proto *myBp) // IN/OUT Backdoor_InOut(myBp); } -/* - *---------------------------------------------------------------------- - * - * Backdoor_MonitorGetProto -- - * - * Get the best protocol to communicate with the host. - * - * Results: - * Returns BALLOON_SUCCESS if successful, otherwise error code. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -int -Backdoor_MonitorGetProto(Balloon *b) // IN -{ - uint32 status; - Backdoor_proto bp; - - bp.in.cx.halfs.low = BALLOON_BDOOR_CMD_GET_PROTO_V3; - - BackdoorBalloon(&bp); - - status = bp.out.ax.word; - if (status == BALLOON_SUCCESS) { - b->hypervisorProtocolVersion = bp.out.cx.word; - } else if (status == BALLOON_ERROR_CMD_INVALID) { - /* - * Let's assume that if the GET_PROTO command doesn't exist, then - * the hypervisor uses the v2 protocol. - */ - b->hypervisorProtocolVersion = BALLOON_PROTOCOL_VERSION_2; - status = BALLOON_SUCCESS; - } - - return status; -} - /* *---------------------------------------------------------------------- @@ -161,12 +120,12 @@ Backdoor_MonitorStart(Balloon *b) // IN status = bp.out.ax.word; /* - * If return code is BALLOON_SUCCESS_V3, then ESX is informing us - * that CMD_GET_PROTO is available, which we can use to gather the - * best protocol to use. + * If return code is BALLOON_SUCCESS_WITH_VERSION, then ESX is + * sending the protocol version to be used into cx. */ - if (status == BALLOON_SUCCESS_V3) { - status = Backdoor_MonitorGetProto(b); + if (status == BALLOON_SUCCESS_WITH_VERSION) { + b->hypervisorProtocolVersion = bp.out.cx.word; + status = BALLOON_SUCCESS; } else if (status == BALLOON_SUCCESS) { b->hypervisorProtocolVersion = BALLOON_PROTOCOL_VERSION_2; } diff --git a/open-vm-tools/modules/shared/vmmemctl/backdoor_balloon.h b/open-vm-tools/modules/shared/vmmemctl/backdoor_balloon.h index 5c17a5abe..13c800bc5 100644 --- a/open-vm-tools/modules/shared/vmmemctl/backdoor_balloon.h +++ b/open-vm-tools/modules/shared/vmmemctl/backdoor_balloon.h @@ -72,7 +72,6 @@ #include "backdoor.h" #include "balloon_def.h" -int Backdoor_MonitorGetProto(Balloon *b); int Backdoor_MonitorStart(Balloon *b); int Backdoor_MonitorGuestType(Balloon *b); int Backdoor_MonitorGetTarget(Balloon *b, uint32 *target); diff --git a/open-vm-tools/modules/shared/vmmemctl/balloon_def.h b/open-vm-tools/modules/shared/vmmemctl/balloon_def.h index b07701cf2..34de14a3d 100644 --- a/open-vm-tools/modules/shared/vmmemctl/balloon_def.h +++ b/open-vm-tools/modules/shared/vmmemctl/balloon_def.h @@ -95,15 +95,6 @@ #define BALLOON_BDOOR_CMD_UNLOCK (3) #define BALLOON_BDOOR_CMD_GUEST_ID (4) -/* - * Helps to negotiate the best protocol version to use between guest and - * host. - * - * The protocol version sent by ESX should never be higher than the - * protocol version of the guest. - */ -#define BALLOON_BDOOR_CMD_GET_PROTO_V3 (5) - /* use config value for max balloon size */ #define BALLOON_MAX_SIZE_USE_CONFIG (0) @@ -138,6 +129,6 @@ typedef enum { * Sent on CMD_START to inform the guest to use the protocol v3 or * higher. */ -#define BALLOON_SUCCESS_V3 (0x03000000) +#define BALLOON_SUCCESS_WITH_VERSION (0x03000000) #endif /* _BALLOON_DEF_H */