]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
vmballoon: cleanup and optimization
authorVMware, Inc <>
Thu, 2 Aug 2012 06:48:30 +0000 (23:48 -0700)
committerDmitry Torokhov <dtor@vmware.com>
Thu, 2 Aug 2012 18:08:34 +0000 (11:08 -0700)
* 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 <dtor@vmware.com>
open-vm-tools/modules/shared/vmmemctl/backdoor_balloon.c
open-vm-tools/modules/shared/vmmemctl/backdoor_balloon.h
open-vm-tools/modules/shared/vmmemctl/balloon_def.h

index def135c9e4aa134ced80abf34de1034d4af5ac3e..d511c7a2e5bb2ea165a3e95ffea807701a3c4d08 100644 (file)
@@ -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;
    }
index 5c17a5abef4cf803b56462170a44fb3917494562..13c800bc579a920528a801ec302ee061b25e9ccb 100644 (file)
@@ -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);
index b07701cf219b8e88f5fe3d153d03f9ad5dff4273..34de14a3d2246ec7f05a0c1bd23ab024c96986ac 100644 (file)
 #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 */