]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Internal branch sync. Included in this change:
authorVMware, Inc <>
Thu, 18 Nov 2010 21:15:11 +0000 (13:15 -0800)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 18 Nov 2010 21:15:11 +0000 (13:15 -0800)
. VIX: code refactoring to use the same parsing code for both requests and
  responses.

. vmxnet3: make Jumbo Frame support available in Solaris driver.

. changes in shared code that don't affect open-vm-tools functionality.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/foundryMsg/foundryMsg.c
open-vm-tools/lib/foundryMsg/foundryPropertyListCommon.c
open-vm-tools/lib/include/vixCommands.h
open-vm-tools/lib/include/x86cpuid.h
open-vm-tools/libguestlib/guestlibV3.x
open-vm-tools/libguestlib/vmGuestLib.c
open-vm-tools/modules/shared/vmxnet/vmxnet3_defs.h
open-vm-tools/modules/solaris/vmxnet3/vmxnet3_main.c
open-vm-tools/modules/solaris/vmxnet3/vmxnet3_rx.c
open-vm-tools/modules/solaris/vmxnet3/vmxnet3_solaris.h
open-vm-tools/services/plugins/vix/vixTools.c

index b17f18a6cd7a9fa2f711d7eaa656a44198251966..56930a26cbbef875c9e264519fe9565c60dda73b 100644 (file)
@@ -482,6 +482,14 @@ static VixError VixMsgDecodeBuffer(const char *str,
                                    char **result,
                                    size_t *bufferLength);
 
+static VixError VMAutomationMsgParserInit(const char *caller,
+                                          unsigned int line,
+                                          VMAutomationMsgParser *state,
+                                          const VixMsgHeader *msg,
+                                          size_t headerLength,
+                                          size_t fixedLength,
+                                          const char *packetType);
+
 
 /*
  *----------------------------------------------------------------------------
@@ -1750,6 +1758,46 @@ VixMsg_ParseGenericRequestMsg(const VixCommandGenericRequest *request,  // IN
 } // VixMsg_ParseGenericRequestMsg
 
 
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VixMsg_ParseSimpleResponseWithString --
+ *
+ *      Takes a response packet that consists of a VixCommandResponseHeader
+ *      followed by a string containing the response data, validates
+ *      the packet, and then passes out a pointer to that string.
+ *
+ * Results:
+ *      VixError
+ *
+ * Side effects:
+ *      None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+VixError
+VixMsg_ParseSimpleResponseWithString(const VixCommandResponseHeader *response,  // IN
+                                     const char **result)                       // OUT
+{
+   VixError err;
+   VMAutomationMsgParser parser;
+
+   err = VMAutomationMsgParserInitResponse(&parser, response, sizeof *response);
+   if (VIX_OK != err) {
+      goto abort;
+   }
+
+   err = VMAutomationMsgParserGetOptionalString(&parser,
+                                                response->commonHeader.bodyLength,
+                                                result);
+
+abort:
+   return err;
+}
+
+
 /*
  *-----------------------------------------------------------------------------
  *
@@ -1979,8 +2027,8 @@ __VMAutomationValidateStringInBuffer(const char  *caller,              // IN
 /*
  *-----------------------------------------------------------------------------
  *
- * __VMAutomationRequestParserInit --
- * VMAutomationRequestParserInit --
+ * __VMAutomationMsgParserInitRequest --
+ * VMAutomationMsgParserInitRequest --
  *
  *      Initializes request parser, and performs basic message validation
  *      not performed elsewhere.
@@ -1995,30 +2043,88 @@ __VMAutomationValidateStringInBuffer(const char  *caller,              // IN
  */
 
 VixError
-__VMAutomationRequestParserInit(const char                    *caller,      // IN
-                                unsigned int                   line,        // IN
-                                VMAutomationRequestParser     *state,       // OUT (opt)
-                                const VixCommandRequestHeader *msg,         // IN
-                                size_t                         fixedLength) // IN
+__VMAutomationMsgParserInitRequest(const char *caller,                  // IN
+                                   unsigned int line,                   // IN
+                                   VMAutomationMsgParser *state,        // OUT (opt)
+                                   const VixCommandRequestHeader *msg,  // IN
+                                   size_t fixedLength)                  // IN
+{
+   return VMAutomationMsgParserInit(caller, line, state, &msg->commonHeader,
+                                    sizeof *msg, fixedLength, "request");
+}
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * __VMAutomationMsgParserInitResponse --
+ * VMAutomationMsgParserInitResponse --
+ *
+ *      Initializes response parser, and performs basic message validation
+ *      not performed elsewhere.
+ *
+ * Results:
+ *      VixError.  VIX_OK on success.  Some other VIX_* code if message is malformed.
+ *
+ * Side effects:
+ *      None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+VixError
+__VMAutomationMsgParserInitResponse(const char *caller,                  // IN
+                                    unsigned int line,                   // IN
+                                    VMAutomationMsgParser *state,        // OUT (opt)
+                                    const VixCommandResponseHeader *msg, // IN
+                                    size_t fixedLength)                  // IN
+{
+   return VMAutomationMsgParserInit(caller, line, state, &msg->commonHeader,
+                                    sizeof *msg, fixedLength, "response");
+}
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VMAutomationMsgParserInit --
+ *
+ *      Initializes message parser, and performs basic message validation
+ *      not performed elsewhere.
+ *
+ * Results:
+ *      VixError. VIX_OK on success. Some other VIX_* code if message is malformed.
+ *
+ * Side effects:
+ *      None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+static VixError
+VMAutomationMsgParserInit(const char *caller,              // IN
+                          unsigned int line,               // IN
+                          VMAutomationMsgParser *state,    // OUT (opt)
+                          const VixMsgHeader *msg,         // IN
+                          size_t headerLength,             // IN
+                          size_t fixedLength,              // IN
+                          const char *packetType)          // IN
 {
-   uint32 requestLength;
+   uint32 headerAndBodyLength;
    // use int64 to prevent overflow
-   int64 computedTotalLength = (int64)msg->commonHeader.headerLength +
-      (int64)msg->commonHeader.bodyLength +
-      (int64)msg->commonHeader.credentialLength;
+   int64 computedTotalLength = (int64)msg->headerLength +
+      (int64)msg->bodyLength + (int64)msg->credentialLength;
 
-   int64 extBodySize =
-      (int64)msg->commonHeader.headerLength +
-      (int64)msg->commonHeader.bodyLength -
+   int64 extBodySize = (int64)msg->headerLength + (int64)msg->bodyLength -
       (int64)fixedLength;
 
-   if (computedTotalLength != (int64)msg->commonHeader.totalMessageLength) {
+   if (computedTotalLength != (int64)msg->totalMessageLength) {
       Log("%s:%d, header information mismatch.\n", __FILE__, __LINE__);
       return VIX_E_INVALID_MESSAGE_HEADER;
    }
 
    if (extBodySize < 0) {
-      Log("%s:%d, request too short.\n", __FILE__, __LINE__);
+      Log("%s:%d, %s too short.\n", __FILE__, __LINE__, packetType);
       return VIX_E_INVALID_MESSAGE_HEADER;
    }
 
@@ -2028,11 +2134,10 @@ __VMAutomationRequestParserInit(const char                    *caller,      // I
     * incompatible with our structures.
     */
 
-   if (msg->commonHeader.headerLength != sizeof *msg) {
-      Log("%s(%u): Request header length %u is not supported "
+   if (msg->headerLength != headerLength) {
+      Log("%s(%u): %s header length %u is not supported "
           "(%"FMTSZ"u is required).\n",
-          caller, line,
-          msg->commonHeader.headerLength, sizeof *msg);
+          caller, line, packetType, msg->headerLength, headerLength);
       return VIX_E_INVALID_MESSAGE_HEADER;
    }
 
@@ -2040,12 +2145,11 @@ __VMAutomationRequestParserInit(const char                    *caller,      // I
     * Message looks reasonable.  Skip over fixed part.
     */
 
-   requestLength = msg->commonHeader.headerLength +
-      msg->commonHeader.bodyLength;
+   headerAndBodyLength = msg->headerLength + msg->bodyLength;
 
    if (state) {
       state->currentPtr = (const char *)msg + fixedLength;
-      state->endPtr = (const char *)msg + requestLength;
+      state->endPtr = (const char *)msg + headerAndBodyLength;
    }
    return VIX_OK;
 }
@@ -2072,14 +2176,14 @@ VixError
 VMAutomation_VerifyRequestLength(const VixCommandRequestHeader *request, // IN
                                  size_t fixedLength)                     // IN
 {
-   return VMAutomationRequestParserInit(NULL, request, fixedLength);
+   return VMAutomationMsgParserInitRequest(NULL, request, fixedLength);
 }
 
 
 /*
  *-----------------------------------------------------------------------------
  *
- * VMAutomationRequestParserGetRemainingData --
+ * VMAutomationMsgParserGetRemainingData --
  *
  *      Fetches all data remaining in the request.
  *
@@ -2093,8 +2197,8 @@ VMAutomation_VerifyRequestLength(const VixCommandRequestHeader *request, // IN
  */
 
 const void *
-VMAutomationRequestParserGetRemainingData(VMAutomationRequestParser  *state,   // IN/OUT
-                                          size_t                     *length)  // OUT
+VMAutomationMsgParserGetRemainingData(VMAutomationMsgParser *state,   // IN/OUT
+                                      size_t *length)                 // OUT
 {
    const void *data;
 
@@ -2109,8 +2213,8 @@ VMAutomationRequestParserGetRemainingData(VMAutomationRequestParser  *state,   /
 /*
  *-----------------------------------------------------------------------------
  *
- * VMAutomationRequestParserGetData --
- * __VMAutomationRequestParserGetData --
+ * VMAutomationMsgParserGetData --
+ * __VMAutomationMsgParserGetData --
  *
  *      Fetches specified number of bytes.
  *
@@ -2124,11 +2228,11 @@ VMAutomationRequestParserGetRemainingData(VMAutomationRequestParser  *state,   /
  */
 
 VixError
-__VMAutomationRequestParserGetData(const char                 *caller,  // IN
-                                   unsigned int                line,    // IN
-                                   VMAutomationRequestParser  *state,   // IN/OUT
-                                   size_t                      length,  // IN
-                                   const char                **result)  // OUT (opt)
+__VMAutomationMsgParserGetData(const char *caller,             // IN
+                               unsigned int line,              // IN
+                               VMAutomationMsgParser *state,   // IN/OUT
+                               size_t length,                  // IN
+                               const char **result)            // OUT (opt)
 {
    size_t available;
 
@@ -2153,8 +2257,8 @@ __VMAutomationRequestParserGetData(const char                 *caller,  // IN
 /*
  *-----------------------------------------------------------------------------
  *
- * VMAutomationRequestParserGetOptionalString --
- * __VMAutomationRequestParserGetOptionalString --
+ * VMAutomationMsgParserGetOptionalString --
+ * __VMAutomationMsgParserGetOptionalString --
  *
  *      Fetches string of specified length from the request.  Length includes
  *      terminating NUL byte, which must be present.  Length of zero results
@@ -2170,18 +2274,18 @@ __VMAutomationRequestParserGetData(const char                 *caller,  // IN
  */
 
 VixError
-__VMAutomationRequestParserGetOptionalString(const char                *caller, // IN
-                                             unsigned int               line,   // IN
-                                             VMAutomationRequestParser *state,  // IN/OUT
-                                             size_t                     length, // IN
-                                             const char               **result) // OUT
+__VMAutomationMsgParserGetOptionalString(const char *caller,           // IN
+                                         unsigned int line,            // IN
+                                         VMAutomationMsgParser *state, // IN/OUT
+                                         size_t length,                // IN
+                                         const char **result)          // OUT
 {
    if (length) {
       VixError err;
       const char *string;
 
-      err = __VMAutomationRequestParserGetData(caller, line, state, length,
-                                               &string);
+      err = __VMAutomationMsgParserGetData(caller, line, state, length,
+                                           &string);
       if (VIX_OK != err) {
          return err;
       }
@@ -2200,8 +2304,8 @@ __VMAutomationRequestParserGetOptionalString(const char                *caller,
 /*
  *-----------------------------------------------------------------------------
  *
- * VMAutomationRequestParserGetOptionalStrings --
- * __VMAutomationRequestParserGetOptionalStrings --
+ * VMAutomationMsgParserGetOptionalStrings --
+ * __VMAutomationMsgParserGetOptionalStrings --
  *
  *      Fetches an array of strings from the request.  Length includes the
  *      terminating NUL byte of each string.
@@ -2217,12 +2321,12 @@ __VMAutomationRequestParserGetOptionalString(const char                *caller,
  */
 
 VixError
-__VMAutomationRequestParserGetOptionalStrings(const char *caller,   // IN
-                                              unsigned int line,    // IN
-                                VMAutomationRequestParser *state,   // IN/OUT
-                                              uint32 count,         // IN
-                                              size_t length,        // IN
-                                              const char **result) // OUT
+__VMAutomationMsgParserGetOptionalStrings(const char *caller,   // IN
+                                          unsigned int line,    // IN
+                                VMAutomationMsgParser *state,   // IN/OUT
+                                          uint32 count,         // IN
+                                          size_t length,        // IN
+                                          const char **result) // OUT
 {
    VixError err = VIX_OK;
    const char *buffer;
@@ -2235,8 +2339,8 @@ __VMAutomationRequestParserGetOptionalStrings(const char *caller,   // IN
       goto abort;
    }
 
-   err = __VMAutomationRequestParserGetData(caller, line, state, length,
-                                            &buffer);
+   err = __VMAutomationMsgParserGetData(caller, line, state, length,
+                                        &buffer);
    if (VIX_OK != err) {
       return err;
    }
@@ -2276,8 +2380,8 @@ abort:
 /*
  *-----------------------------------------------------------------------------
  *
- * VMAutomationRequestParserGetString --
- * __VMAutomationRequestParserGetString --
+ * VMAutomationMsgParserGetString --
+ * __VMAutomationMsgParserGetString --
  *
  *      Fetches string of specified length from the request.  Length of
  *      string is specified in number of usable characters: function consumes
@@ -2294,11 +2398,11 @@ abort:
  */
 
 VixError
-__VMAutomationRequestParserGetString(const char                *caller, // IN
-                                     unsigned int               line,   // IN
-                                     VMAutomationRequestParser *state,  // IN/OUT
-                                     size_t                     length, // IN
-                                     const char               **result) // OUT
+__VMAutomationMsgParserGetString(const char *caller,            // IN
+                                 unsigned int line,             // IN
+                                 VMAutomationMsgParser *state,  // IN/OUT
+                                 size_t length,                 // IN
+                                 const char **result)           // OUT
 {
    VixError err;
    const char *string;
@@ -2308,8 +2412,8 @@ __VMAutomationRequestParserGetString(const char                *caller, // IN
       Log("%s(%u): String is too long.\n", caller, line);
       return VIX_E_INVALID_ARG;
    }
-   err = __VMAutomationRequestParserGetData(caller, line, state, length,
-                                            &string);
+   err = __VMAutomationMsgParserGetData(caller, line, state, length,
+                                        &string);
    if (VIX_OK != err) {
       return err;
    }
@@ -2326,8 +2430,8 @@ __VMAutomationRequestParserGetString(const char                *caller, // IN
 /*
  *-----------------------------------------------------------------------------
  *
- * VMAutomationRequestParserGetPropertyList --
- * __VMAutomationRequestParserGetPropertyList --
+ * VMAutomationMsgParserGetPropertyList --
+ * __VMAutomationMsgParserGetPropertyList --
  *
  *      Fetches specified number of bytes.
  *
@@ -2341,11 +2445,11 @@ __VMAutomationRequestParserGetString(const char                *caller, // IN
  */
 
 VixError
-__VMAutomationRequestParserGetPropertyList(const char                *caller,   // IN
-                                           unsigned int               line,     // IN
-                                           VMAutomationRequestParser *state,    // IN/OUT
-                                           size_t                     length,   // IN
-                                           VixPropertyListImpl       *propList) // IN/OUT
+__VMAutomationMsgParserGetPropertyList(const char *caller,            // IN
+                                       unsigned int line,             // IN
+                                       VMAutomationMsgParser *state,  // IN/OUT
+                                       size_t length,                 // IN
+                                       VixPropertyListImpl *propList) // IN/OUT
 {
    VixError err;
 
@@ -2353,8 +2457,8 @@ __VMAutomationRequestParserGetPropertyList(const char                *caller,
    if (length) {
       const char *data;
 
-      err = __VMAutomationRequestParserGetData(caller, line, state, length,
-                                               &data);
+      err = __VMAutomationMsgParserGetData(caller, line, state, length,
+                                           &data);
       if (VIX_OK == err) {
          err = VixPropertyList_Deserialize(propList, data, length,
                                            VIX_PROPERTY_LIST_BAD_ENCODING_ERROR);
index e9c98380004d0565162850b5a977c0e5ee6fc656..7af9be041989e6a5c85ccab31c545f9f07202f52 100644 (file)
@@ -172,6 +172,8 @@ VixPropertyList_Serialize(VixPropertyListImpl    *propList,       // IN
    size_t bufferSize = 0;
    size_t pos = 0;
  
+   ASSERT_ON_COMPILE(PROPERTY_LENGTH_SIZE == sizeof valueLength);
+
    if ((NULL == propList) ||
        (NULL == resultSize) ||
        (NULL == resultBuffer)) {
@@ -271,7 +273,11 @@ VixPropertyList_Serialize(VixPropertyListImpl    *propList,       // IN
       property = property->next;
    }
 
-   *resultBuffer = (char*) Util_SafeCalloc(1, bufferSize);
+   *resultBuffer = (char*) VixMsg_MallocClientData(bufferSize);
+   if (NULL == *resultBuffer) {
+      err = VIX_E_OUT_OF_MEMORY;
+      goto abort;
+   }
    serializeBuffer = *resultBuffer;
 
    pos = 0;
index 79864fbaf9dc122f026c541aab1740305e806752..ba0bc0fc66979546342de11eacd8e325d197bcc5 100644 (file)
@@ -2499,77 +2499,107 @@ VixError VixMsg_ParseGenericRequestMsg(const VixCommandGenericRequest *request,
                                        int *options,
                                        VixPropertyListImpl *propertyList);
 
+VixError
+VixMsg_ParseSimpleResponseWithString(const VixCommandResponseHeader *response,
+                                     const char **result);
+
 void *VixMsg_MallocClientData(size_t size);
 void *VixMsg_ReallocClientData(void *ptr, size_t size);
 char *VixMsg_StrdupClientData(const char *s, Bool *allocateFailed);
 
 /*
- * Parser state used by VMAutomationRequestParser* group of functions.
+ * Parser state used by VMAutomationMsgParser* group of functions.
  */
 typedef struct {
    const char *currentPtr;
    const char *endPtr;
-} VMAutomationRequestParser;
-
-#define VMAutomationRequestParserInit(state, msg, fixedLength) \
-        __VMAutomationRequestParserInit(__FUNCTION__, __LINE__, state, msg, fixedLength)
-VixError __VMAutomationRequestParserInit(const char                    *caller,
-                                         unsigned int                   line,
-                                         VMAutomationRequestParser     *state,
-                                         const struct VixCommandRequestHeader *msg,
-                                         size_t                         fixedLength);
-
-const void * VMAutomationRequestParserGetRemainingData(VMAutomationRequestParser  *state,
-                                                       size_t                     *length);
-
-#define VMAutomationRequestParserGetData(state, length, result) \
-        __VMAutomationRequestParserGetData(__FUNCTION__, __LINE__, \
-                                           state, length, (const char **)result)
-VixError __VMAutomationRequestParserGetData(const char                 *caller,
-                                            unsigned int                line,
-                                            VMAutomationRequestParser  *state,
-                                            size_t                      length,
-                                            const char                **result);
-
-#define VMAutomationRequestParserGetOptionalString(state, length, result) \
-        __VMAutomationRequestParserGetOptionalString(__FUNCTION__, __LINE__, \
-                                                     state, length, result)
-VixError __VMAutomationRequestParserGetOptionalString(const char                *caller,
-                                                      unsigned int               line,
-                                                      VMAutomationRequestParser *state,
-                                                      size_t                     length,
-                                                      const char               **result);
-
-#define VMAutomationRequestParserGetOptionalStrings(state, count, length,     \
+} VMAutomationMsgParser;
+
+/* Keep the original type name around all the old code can stay the same. */
+typedef VMAutomationMsgParser VMAutomationRequestParser;
+
+
+#define VMAutomationRequestParserInit VMAutomationMsgParserInitRequest
+#define VMAutomationMsgParserInitRequest(state, msg, fixedLength) \
+   __VMAutomationMsgParserInitRequest(__FUNCTION__, __LINE__, state, msg, fixedLength)
+VixError
+__VMAutomationMsgParserInitRequest(const char *caller,
+                                   unsigned int line,
+                                   VMAutomationMsgParser *state,
+                                   const struct VixCommandRequestHeader *msg,
+                                   size_t fixedLength);
+
+#define VMAutomationMsgParserInitResponse(state, msg, fixedLength) \
+   __VMAutomationMsgParserInitResponse(__FUNCTION__, __LINE__, state, msg, fixedLength)
+VixError
+__VMAutomationMsgParserInitResponse(const char *caller,
+                                    unsigned int line,
+                                    VMAutomationMsgParser *state,
+                                    const struct VixCommandResponseHeader *msg,
+                                    size_t fixedLength);
+
+#define VMAutomationRequestParserGetRemainingData \
+   VMAutomationMsgParserGetRemainingData
+const void *
+VMAutomationMsgParserGetRemainingData(VMAutomationMsgParser *state,
+                                      size_t *length);
+
+#define VMAutomationRequestParserGetData VMAutomationMsgParserGetData
+#define VMAutomationMsgParserGetData(state, length, result) \
+   __VMAutomationMsgParserGetData(__FUNCTION__, __LINE__,               \
+                                  state, length, (const char **)result)
+VixError __VMAutomationMsgParserGetData(const char *caller,
+                                        unsigned int line,
+                                        VMAutomationMsgParser *state,
+                                        size_t length,
+                                        const char **result);
+
+#define VMAutomationRequestParserGetOptionalString \
+   VMAutomationMsgParserGetOptionalString
+#define VMAutomationMsgParserGetOptionalString(state, length, result) \
+   __VMAutomationMsgParserGetOptionalString(__FUNCTION__, __LINE__,     \
+                                            state, length, result)
+VixError __VMAutomationMsgParserGetOptionalString(const char *caller,
+                                                  unsigned int line,
+                                                  VMAutomationMsgParser *state,
+                                                  size_t length,
+                                                  const char **result);
+
+#define VMAutomationRequestParserGetOptionalStrings \
+   VMAutomationMsgParserGetOptionalStrings
+#define VMAutomationMsgParserGetOptionalStrings(state, count, length,     \
            result)                                                            \
-   __VMAutomationRequestParserGetOptionalStrings(__FUNCTION__, __LINE__,      \
-                                                 state, count, length, result)
-VixError __VMAutomationRequestParserGetOptionalStrings
-   (const char                *caller,
-    unsigned int               line,
-    VMAutomationRequestParser *state,
-    uint32                     count,
-    size_t                     length,
-    const char               **result);
-
-#define VMAutomationRequestParserGetString(state, length, result) \
-        __VMAutomationRequestParserGetString(__FUNCTION__, __LINE__, \
-                                             state, length, result)
-VixError __VMAutomationRequestParserGetString(const char                *caller,
-                                              unsigned int               line,
-                                              VMAutomationRequestParser *state,
-                                              size_t                     length,
-                                              const char               **result);
-
-
-#define VMAutomationRequestParserGetPropertyList(state, length, propList) \
-        __VMAutomationRequestParserGetPropertyList(__FUNCTION__, __LINE__, \
-                                                   state, length, propList)
-VixError __VMAutomationRequestParserGetPropertyList(const char                *caller,
-                                                    unsigned int               line,
-                                                    VMAutomationRequestParser *state,
-                                                    size_t                     length,
-                                                    VixPropertyListImpl       *propList);
+   __VMAutomationMsgParserGetOptionalStrings(__FUNCTION__, __LINE__,      \
+                                             state, count, length, result)
+VixError __VMAutomationMsgParserGetOptionalStrings
+   (const char *caller,
+    unsigned int line,
+    VMAutomationMsgParser *state,
+    uint32 count,
+    size_t length,
+    const char **result);
+
+#define VMAutomationRequestParserGetString VMAutomationMsgParserGetString
+#define VMAutomationMsgParserGetString(state, length, result) \
+   __VMAutomationMsgParserGetString(__FUNCTION__, __LINE__,             \
+                                    state, length, result)
+VixError __VMAutomationMsgParserGetString(const char *caller,
+                                          unsigned int line,
+                                          VMAutomationMsgParser *state,
+                                          size_t length,
+                                          const char **result);
+
+#define VMAutomationRequestParserGetPropertyList \
+   VMAutomationMsgParserGetPropertyList
+#define VMAutomationMsgParserGetPropertyList(state, length, propList) \
+   __VMAutomationMsgParserGetPropertyList(__FUNCTION__, __LINE__,       \
+                                          state, length, propList)
+VixError
+__VMAutomationMsgParserGetPropertyList(const char *caller,
+                                       unsigned int line,
+                                       VMAutomationMsgParser *state,
+                                       size_t length,
+                                       VixPropertyListImpl *propList);
 
 #endif   // VIX_HIDE_FROM_JAVA
 
index d0655edec1a5aa140af9e1e556c32d6b4c212e96..4c2daac1e4669ceffaaa3cca186034c3e0f80d25 100644 (file)
@@ -619,7 +619,7 @@ FIELDDEFA( 81D,EAX, AMD,     0,  5, CACHE_TYPE,          NA,  FALSE, AMD_CACHE_T
 FIELDDEFA( 81D,EAX, AMD,     5,  3, CACHE_LEVEL,         NA,  FALSE, AMD_CACHE_LEVEL) \
 FLAGDEF( 81D, EAX, AMD,     8,  1, CACHE_SELF_INIT,     NA,  FALSE)            \
 FLAGDEF( 81D, EAX, AMD,     9,  1, CACHE_FULLY_ASSOC,   NA,  FALSE)            \
-FIELDDEF(81D, EAX, AMD,    14, 12, NUM_SHARING_CACHE,   NA,  FALSE)            \
+FIELDDEFA(81D, EAX, AMD,    14, 12, NUM_SHARING_CACHE,   NA,  FALSE, AMD_NUM_SHARING_CACHE)            \
 FIELDDEF(81D, EBX, AMD,     0, 12, CACHE_LINE_SIZE,     NA,  FALSE)            \
 FIELDDEF(81D, EBX, AMD,    12, 10, CACHE_PHYS_PARTITIONS, NA, FALSE)           \
 FIELDDEFA(81D,EBX, AMD,   22, 10, CACHE_WAYS,          NA,  FALSE, AMD_CACHE_WAYS) \
@@ -628,7 +628,7 @@ FLAGDEF( 81D, EDX, AMD,     0,  1, CACHE_WBINVD,        NA,  FALSE)            \
 FLAGDEF( 81D, EDX, AMD,     1,  1, CACHE_INCLUSIVE,     NA,  FALSE)            \
 FIELDDEF(81E, EAX, AMD,     0, 32, EXTENDED_APICID,     NA,  FALSE)            \
 FIELDDEF(81E, EBX, AMD,     0,  8, COMPUTE_UNIT_ID,     NA,  FALSE)            \
-FIELDDEF(81E, EBX, AMD,     8,  2, CORES_PER_COMPUTE_UNIT, NA, FALSE)          \
+FIELDDEFA(81E, EBX, AMD,     8,  2, CORES_PER_COMPUTE_UNIT, NA, FALSE, AMD_CORES_PER_COMPUTE_UNIT)          \
 FIELDDEF(81E, ECX, AMD,     0,  8, NODEID,              NA,  FALSE)            \
 FIELDDEFA( 81E,ECX, AMD,     8,  3, NODES_PER_PKG,       NA,  FALSE, AMD_NODES_PER_PKG)
 
@@ -793,6 +793,8 @@ FIELD_FUNC(AMD_CACHE_TYPE,      CPUID_AMD_ID81DEAX_CACHE_TYPE)
 FIELD_FUNC(AMD_CACHE_LEVEL,     CPUID_AMD_ID81DEAX_CACHE_LEVEL)
 FIELD_FUNC(AMD_CACHE_WAYS,      CPUID_AMD_ID81DEBX_CACHE_WAYS)
 FIELD_FUNC(AMD_NODES_PER_PKG,   CPUID_AMD_ID81EECX_NODES_PER_PKG)
+FIELD_FUNC(AMD_NUM_SHARING_CACHE, CPUID_AMD_ID81DEAX_NUM_SHARING_CACHE)
+FIELD_FUNC(AMD_CORES_PER_COMPUTE_UNIT, CPUID_AMD_ID81EEBX_CORES_PER_COMPUTE_UNIT)
 #undef FIELD_FUNC
 
 
index ef2ea365da7a2d69e73793470ea80c0a8d296a2d..d3c88c40c4363621360da04f6c2d74c72b990599 100644 (file)
@@ -87,11 +87,19 @@ enum GuestLibV3TypeIds {
    GUESTLIB_HOST_MEM_KERN_OVHD_MB   = 28,
    GUESTLIB_HOST_MEM_MAPPED_MB      = 29,
    GUESTLIB_HOST_MEM_UNMAPPED_MB    = 30,
-   GUESTLIB_RESOURCE_POOL_PATH_LONG = 31,
+
+   /* Counters added in ESX5.0 */
+   GUESTLIB_MEM_ZIPPED_MB           = 31,
+   GUESTLIB_MEM_ZIPSAVED_MB         = 32,
+   GUESTLIB_MEM_LLSWAPPED_MB        = 33,
+   GUESTLIB_MEM_SWAP_TARGET_MB      = 34,
+   GUESTLIB_MEM_BALLOON_TARGET_MB   = 35,
+   GUESTLIB_MEM_BALLOON_MAX_MB      = 36,
+   GUESTLIB_RESOURCE_POOL_PATH_LONG = 37,
    /*------ Add any new statistics above this line. ------- */
 
    /*------ Bump this when adding to this list. -------*/
-   GUESTLIB_MAX_STATISTIC_ID        = 32
+   GUESTLIB_MAX_STATISTIC_ID        = 38
 };
 
 union GuestLibV3Stat switch (GuestLibV3TypeIds d) {
@@ -161,6 +169,18 @@ union GuestLibV3Stat switch (GuestLibV3TypeIds d) {
       struct GuestLibV3StatUint64 hostMemMappedMB;
    case GUESTLIB_HOST_MEM_UNMAPPED_MB:
       struct GuestLibV3StatUint64 hostMemUnmappedMB;
+   case GUESTLIB_MEM_ZIPPED_MB:
+      struct GuestLibV3StatUint32 memZippedMB;
+   case GUESTLIB_MEM_ZIPSAVED_MB:
+      struct GuestLibV3StatUint32 memZipSavedMB;
+   case GUESTLIB_MEM_LLSWAPPED_MB:
+      struct GuestLibV3StatUint32 memLLSwappedMB;
+   case GUESTLIB_MEM_SWAP_TARGET_MB:
+      struct GuestLibV3StatUint32 memSwapTargetMB;
+   case GUESTLIB_MEM_BALLOON_TARGET_MB:
+      struct GuestLibV3StatUint32 memBalloonTargetMB;
+   case GUESTLIB_MEM_BALLOON_MAX_MB:
+      struct GuestLibV3StatUint32 memBalloonMaxMB;
    case GUESTLIB_RESOURCE_POOL_PATH_LONG:
       struct GuestLibV3ByteArray resourcePoolPathLong;
 };
index 8a7225b07d698ed017e24031ac056938fc7f2577..29c7161c4567c876bfe8a8cba53513a18ee666f0 100644 (file)
@@ -1593,6 +1593,174 @@ VMGuestLib_GetHostMemUnmappedMB(VMGuestLibHandle handle,    // IN
 }
 
 
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VMGuestLib_GetMemZippedMB --
+ *
+ *      Total zipped VM memory
+ *
+ * Results:
+ *      VMGuestLibError
+ *
+ * Side effects:
+ *      None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+VMGuestLibError
+VMGuestLib_GetMemZippedMB(VMGuestLibHandle handle,    // IN
+                          uint32 *memZippedMB)        // OUT
+{
+   VMGuestLibError error = VMGUESTLIB_ERROR_OTHER;
+   VMGUESTLIB_GETSTAT_V3(handle, error,
+                         memZippedMB, memZippedMB,
+                         GUESTLIB_MEM_ZIPPED_MB);
+   return error;
+}
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VMGuestLib_GetMemZipSavedMB --
+ *
+ *      Total memopry saved by zipping VM memory
+ *
+ * Results:
+ *      VMGuestLibError
+ *
+ * Side effects:
+ *      None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+VMGuestLibError
+VMGuestLib_GetMemZipSavedMB(VMGuestLibHandle handle,    // IN
+                            uint32 *memZipSavedMB)      // OUT
+{
+   VMGuestLibError error = VMGUESTLIB_ERROR_OTHER;
+   VMGUESTLIB_GETSTAT_V3(handle, error,
+                         memZipSavedMB, memZipSavedMB,
+                         GUESTLIB_MEM_ZIPSAVED_MB);
+   return error;
+}
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VMGuestLib_GetMemLLSwappedMB --
+ *
+ *      VM memory swapped to SSD
+ *
+ * Results:
+ *      VMGuestLibError
+ *
+ * Side effects:
+ *      None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+VMGuestLibError
+VMGuestLib_GetMemLLSwappedMB(VMGuestLibHandle handle,    // IN
+                             uint32 *memLLSwappedMB)     // OUT
+{
+   VMGuestLibError error = VMGUESTLIB_ERROR_OTHER;
+   VMGUESTLIB_GETSTAT_V3(handle, error,
+                         memLLSwappedMB, memLLSwappedMB,
+                         GUESTLIB_MEM_LLSWAPPED_MB);
+   return error;
+}
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VMGuestLib_GetMemSwapTargetMB --
+ *
+ *      VM memory swap target
+ *
+ * Results:
+ *      VMGuestLibError
+ *
+ * Side effects:
+ *      None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+VMGuestLibError
+VMGuestLib_GetMemSwapTargetMB(VMGuestLibHandle handle,    // IN
+                              uint32 *memSwapTargetMB)    // OUT
+{
+   VMGuestLibError error = VMGUESTLIB_ERROR_OTHER;
+   VMGUESTLIB_GETSTAT_V3(handle, error,
+                         memSwapTargetMB, memSwapTargetMB,
+                         GUESTLIB_MEM_SWAP_TARGET_MB);
+   return error;
+}
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VMGuestLib_GetMemBalloonTargetMB --
+ *
+ *      VM memory balloon target size
+ *
+ * Results:
+ *      VMGuestLibError
+ *
+ * Side effects:
+ *      None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+VMGuestLibError
+VMGuestLib_GetMemBalloonTargetMB(VMGuestLibHandle handle,    // IN
+                                 uint32 *memBalloonTargetMB) // OUT
+{
+   VMGuestLibError error = VMGUESTLIB_ERROR_OTHER;
+   VMGUESTLIB_GETSTAT_V3(handle, error,
+                         memBalloonTargetMB, memBalloonTargetMB,
+                         GUESTLIB_MEM_BALLOON_TARGET_MB);
+   return error;
+}
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VMGuestLib_GetMemBalloonMaxMB --
+ *
+ *      VM memory balloon limit
+ *
+ * Results:
+ *      VMGuestLibError
+ *
+ * Side effects:
+ *      None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+VMGuestLibError
+VMGuestLib_GetMemBalloonMaxMB(VMGuestLibHandle handle,    // IN
+                              uint32 *memBalloonMaxMB)    // OUT
+{
+   VMGuestLibError error = VMGUESTLIB_ERROR_OTHER;
+   VMGUESTLIB_GETSTAT_V3(handle, error,
+                         memBalloonMaxMB, memBalloonMaxMB,
+                         GUESTLIB_MEM_BALLOON_MAX_MB);
+   return error;
+}
+
+
 /*
  *-----------------------------------------------------------------------------
  *
index a438ae7af03986c71be36f4718513afcb0602c1d..34994b0dd81c73c2c67c25e825fa785eeed5b2f1 100644 (file)
@@ -736,4 +736,6 @@ do {\
 
 #define VMXWIFI_DRIVER_SHARED_LEN 8192
 
+#define VMXNET3_DID_PASSTHRU    0xFFFF
+
 #endif /* _VMXNET3_DEFS_H_ */
index 824f4c343e172d752992105a32c30ed393cd8b2e..3ad09661bb38b76ea4a7e22cf4c315fd815f9fd6 100644 (file)
@@ -31,25 +31,26 @@ static int       vmxnet3_getstat(void *, uint_t, uint64_t *);
 static int       vmxnet3_start(void *);
 static void      vmxnet3_stop(void *);
 static int       vmxnet3_setpromisc(void *, boolean_t);
+static void      vmxnet3_ioctl(void *arg, queue_t *wq, mblk_t *mp);
 static int       vmxnet3_multicst(void *, boolean_t, const uint8_t *);
 static int       vmxnet3_unicst(void *, const uint8_t *);
 static boolean_t vmxnet3_getcapab(void *, mac_capab_t, void *);
 
 /* MAC callbacks */
 static mac_callbacks_t vmxnet3_mac_callbacks = {
-   MC_GETCAPAB,        /* mc_callbacks */
-   vmxnet3_getstat,    /* mc_getstat */
-   vmxnet3_start,      /* mc_start */
-   vmxnet3_stop,       /* mc_stop */
-   vmxnet3_setpromisc, /* mc_setpromisc */
-   vmxnet3_multicst,   /* mc_multicst */
-   vmxnet3_unicst,     /* mc_unicst */
-   vmxnet3_tx,         /* mc_tx */
+   .mc_callbacks = MC_GETCAPAB | MC_IOCTL,
+   .mc_getstat = vmxnet3_getstat,
+   .mc_start = vmxnet3_start,
+   .mc_stop = vmxnet3_stop,
+   .mc_setpromisc = vmxnet3_setpromisc,
+   .mc_multicst = vmxnet3_multicst,
+   .mc_unicst = vmxnet3_unicst,
+   .mc_tx = vmxnet3_tx,
 #ifndef OPEN_SOLARIS
-   NULL,               /* mc_resources */
+   .mc_resources = NULL,
 #endif
-   NULL,               /* mc_ioctl */
-   vmxnet3_getcapab    /* mc_getcapab */
+   .mc_ioctl = vmxnet3_ioctl,
+   .mc_getcapab = *vmxnet3_getcapab,
 };
 
 /* Tx DMA engine description */
@@ -250,7 +251,8 @@ vmxnet3_prepare_drivershared(vmxnet3_softc_t *dp)
    ds->devRead.misc.driverInfo.uptVerSpt = 1;
 
    ds->devRead.misc.uptFeatures = UPT1_F_RXCSUM;
-   ds->devRead.misc.mtu = ETHERMTU;
+   ds->devRead.misc.mtu = dp->cur_mtu;
+
    // XXX: ds->devRead.misc.maxNumRxSG
    ds->devRead.misc.numTxQueues = 1;
    ds->devRead.misc.numRxQueues = 1;
@@ -651,7 +653,7 @@ vmxnet3_start(void *data)
     */
    rxQueueSize = vmxnet3_getprop(dp, "RxRingSize", 32, 4096,
                                  VMXNET3_DEF_RX_RING_SIZE);
-   if (!(txQueueSize & VMXNET3_RING_SIZE_MASK)) {
+   if (!(rxQueueSize & VMXNET3_RING_SIZE_MASK)) {
       dp->rxQueue.cmdRing.size = rxQueueSize;
       dp->rxQueue.compRing.size = rxQueueSize;
       dp->rxQueue.sharedCtrl = &rqdesc->ctrl;
@@ -938,6 +940,164 @@ vmxnet3_unicst(void *data, const uint8_t *macaddr)
    return DDI_SUCCESS;
 }
 
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * vmxnet3_change_mtu --
+ *
+ *    Change the MTU as seen by the driver. Reset the device and tx/rx queues
+ *    so that buffers of right size are posted in rx queues.
+ *
+ * Results:
+ *    EINVAL for invalid MTUs or other failures. 0 for success.
+ *
+ * Side effects:
+ *    None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static int
+vmxnet3_change_mtu(vmxnet3_softc_t *dp, uint32_t new_mtu)
+{
+   int ret = 0, do_reset = 0;
+   ASSERT(dp);
+   if (new_mtu == dp->cur_mtu) {
+      VMXNET3_WARN(dp, "New MTU is same as old mtu : %d.\n", new_mtu);
+      return 0;
+   }
+
+   if (new_mtu < VMXNET3_MIN_MTU || new_mtu > VMXNET3_MAX_MTU) {
+      VMXNET3_WARN(dp, "New MTU not in valid range [%d, %d].\n",
+                   VMXNET3_MIN_MTU, VMXNET3_MAX_MTU);
+      return EINVAL;
+   }
+
+   if (dp->devEnabled) {
+      do_reset = 1;
+      vmxnet3_stop(dp);
+      VMXNET3_BAR1_PUT32(dp, VMXNET3_REG_CMD, VMXNET3_CMD_RESET_DEV);
+   }
+
+   dp->cur_mtu = new_mtu;
+
+   if (do_reset)
+      ret = vmxnet3_start(dp);
+
+   return ret;
+}
+
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * vmxnet3_ioctl --
+ *
+ *    DDI/DDK callback to handle IOCTL in driver. Currently it only handles
+ *    ND_SET ioctl. Rest all are ignored. The ND_SET is used to set/reset
+ *    accept-jumbo ndd parameted for the interface.
+ *
+ * Results:
+ *    Nothing is returned directly. An ACK or NACK is conveyed to the calling
+ *    function from the mblk which was used to call this function.
+ *
+ * Side effects:
+ *    MTU can be changed and device can be reset.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static void
+vmxnet3_ioctl(void *arg, queue_t *wq, mblk_t *mp)
+{
+   vmxnet3_softc_t *dp = arg;
+   int             ret = EINVAL;
+   IOCP            iocp;
+   mblk_t          *mp1;
+   char            *valp, *param;
+   int             data;
+
+   iocp = (void *)mp->b_rptr;
+   iocp->ioc_error = 0;
+
+   switch (iocp->ioc_cmd) {
+   case ND_SET:
+
+      /* the mblk in continuation would contain the ndd parameter name
+       * and data value to be set
+       */
+      mp1 = mp->b_cont;
+      if (!mp1) {
+         VMXNET3_WARN(dp, "Error locating parameter name.\n");
+         ret = EINVAL;
+         break;
+      }
+
+      mp1->b_datap->db_lim[-1] = '\0'; /* Force null termination */
+
+      /*
+       * From /usr/src/uts/common/inet/nd.c : nd_getset()
+       * "logic throughout nd_xxx assumes single data block for ioctl.
+       *  However, existing code sends in some big buffers."
+       */
+      if (mp1->b_cont) {
+         freemsg(mp1->b_cont);
+         mp1->b_cont = NULL;
+      }
+
+      valp = (char *)mp1->b_rptr;      /* Points to param name*/
+      ASSERT(valp);
+      param = valp;
+      VMXNET3_DEBUG(dp, 3, "ND Set ioctl for %s\n", param);
+
+      /* Go past the end of this null terminated string to get the data value.*/
+      while (*valp && valp <= (char *)mp1->b_wptr)
+         valp++;
+
+      if (valp > (char *)mp1->b_wptr) {
+         /* We are already beyond the readable area of mblk and still havent
+          * found the end of param string.
+          */
+         VMXNET3_WARN(dp, "No data value found to be set to param.\n");
+         data = -1;
+      } else {
+         valp++;                        /* Now this points to data string */
+         data = (int)*valp - (int)'0';  /* Get numeric value of first letter */
+      }
+
+      if (strcmp("accept-jumbo", param) == 0) {
+         if (data == 1) {
+            VMXNET3_DEBUG(dp, 2, "Accepting jumbo frames\n");
+            ret = vmxnet3_change_mtu(dp, VMXNET3_MAX_MTU);
+         } else if (data == 0) {
+            VMXNET3_DEBUG(dp, 2, "Rejecting jumbo frames\n");
+            ret = vmxnet3_change_mtu(dp, ETHERMTU);
+         } else {
+            VMXNET3_WARN(dp, "Invalid data value to be set, use 1 or 0.\n");
+            ret = -1;
+         }
+      }
+      freemsg(mp1);
+      mp->b_cont = NULL;
+      break;
+
+   default:
+      if (mp->b_cont) {
+         freemsg(mp->b_cont);
+         mp->b_cont = NULL;
+      }
+      ret = -1;
+      break;
+   }
+
+   if (ret == 0)
+      miocack(wq, mp, 0, 0);
+   else
+      miocnak(wq, mp, 0, EINVAL);
+}
+
+
 /*
  *---------------------------------------------------------------------------
  *
@@ -1128,6 +1288,7 @@ intr_unclaimed:
    return DDI_INTR_UNCLAIMED;
 }
 
+
 /*
  *---------------------------------------------------------------------------
  *
@@ -1165,6 +1326,7 @@ vmxnet3_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
 
    dp->dip = dip;
    dp->instance = ddi_get_instance(dip);
+   dp->cur_mtu = ETHERMTU;
 
    VMXNET3_DEBUG(dp, 1, "attach()\n");
 
@@ -1252,8 +1414,8 @@ vmxnet3_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
    macr->m_src_addr = dp->macaddr;
    macr->m_dst_addr = NULL;
    macr->m_callbacks = &vmxnet3_mac_callbacks;
-   macr->m_min_sdu = 0;
-   macr->m_max_sdu = ETHERMTU;
+   macr->m_min_sdu = VMXNET3_MIN_MTU;
+   macr->m_max_sdu = VMXNET3_MAX_MTU;
    macr->m_pdata = NULL;
    macr->m_pdata_size = 0;
 
index 9756d4ebc1c5dbc8bcceb8128d7111d51be64c08..f23a7914f627b2e9b0d6bf31f2afc5b921bb48ff 100644 (file)
@@ -16,8 +16,6 @@
 
 #include "vmxnet3_solaris.h"
 
-#define VMXNET3_RXBUF_SIZE (ETHERMTU + 18)
-
 static void vmxnet3_put_rxbuf(vmxnet3_rxbuf_t *rxBuf);
 
 /*
@@ -41,14 +39,18 @@ vmxnet3_alloc_rxbuf(vmxnet3_softc_t *dp, boolean_t canSleep)
 {
    vmxnet3_rxbuf_t *rxBuf;
    int flag = canSleep ? KM_SLEEP : KM_NOSLEEP;
+   int err;
 
    rxBuf = kmem_zalloc(sizeof(vmxnet3_rxbuf_t), flag);
    if (!rxBuf) {
       return NULL;
    }
 
-   if (vmxnet3_alloc_dma_mem_1(dp, &rxBuf->dma, VMXNET3_RXBUF_SIZE,
-                               canSleep) != DDI_SUCCESS) {
+   if ((err = vmxnet3_alloc_dma_mem_1(dp, &rxBuf->dma, (dp->cur_mtu + 18),
+                                      canSleep)) != DDI_SUCCESS) {
+
+      VMXNET3_DEBUG(dp, 0, "Failed to allocate %d bytes for rx buf, err:%d.\n",
+                    (dp->cur_mtu + 18), err);
       kmem_free(rxBuf, sizeof(vmxnet3_rxbuf_t));
       return NULL;
    }
index 4fe28752ca92fd3e13b32d58bb7508a06304f4b1..db7ab050cab356a1a964b086eaf4517fb8aba610 100644 (file)
@@ -116,14 +116,6 @@ typedef struct vmxnet3_rxqueue_t {
    Vmxnet3_RxQueueCtrl *sharedCtrl;
 } vmxnet3_rxqueue_t;
 
-#if 0
-enum {
-   PARAM_ACCEPT_JUMBO = 0,
-   PARAM_MTU
-   VMXNET3_PARAM_COUNT
-};
-
-#endif
 
 typedef struct vmxnet3_softc_t {
    dev_info_t          *dip;
@@ -161,7 +153,6 @@ typedef struct vmxnet3_softc_t {
    uint32_t             rxMode;
 
    vmxnet3_dmabuf_t     mfTable;
-//   caddr_t           nd_arg_p;
 } vmxnet3_softc_t;
 
 int       vmxnet3_alloc_dma_mem_1(vmxnet3_softc_t *dp, vmxnet3_dmabuf_t *dma,
index 01c80d07dd3c2784076e65231daee83b7ab3e2ee..3bb938be541d58441e606d6c479ac2f1344c64f7 100644 (file)
@@ -3784,8 +3784,8 @@ VixToolsMoveObject(VixCommandRequestHeader *requestMsg)        // IN
 
    success = File_Rename(srcFilePathName, destFilePathName);
    if (!success) {
-      Debug("%s: File_Rename failed.\n", __FUNCTION__);
       err = FoundryToolsDaemon_TranslateSystemErr();
+      Debug("%s: File_Rename failed.\n", __FUNCTION__);
       goto abort;
    }
 
@@ -5381,13 +5381,13 @@ VixToolsSetFileAttributes(VixCommandRequestHeader *requestMsg)    // IN
          }
 
          if (!Win32U_SetFileAttributes(filePathName, fileAttr)) {
-            Debug("%s: Failed to set the file attributes\n", __FUNCTION__);
             err = FoundryToolsDaemon_TranslateSystemErr();
+            Debug("%s: Failed to set the file attributes\n", __FUNCTION__);
             goto abort;
          }
       } else {
-         Debug("%s: Failed to get the file attributes\n", __FUNCTION__);
          err = FoundryToolsDaemon_TranslateSystemErr();
+         Debug("%s: Failed to get the file attributes\n", __FUNCTION__);
          goto abort;
       }
    }
@@ -5396,8 +5396,8 @@ VixToolsSetFileAttributes(VixCommandRequestHeader *requestMsg)    // IN
       success = File_SetFilePermissions(filePathName,
                                         setGuestFileAttributesRequest->permissions);
       if (!success) {
-         Debug("%s: Failed to set the file permissions\n", __FUNCTION__);
          err = FoundryToolsDaemon_TranslateSystemErr();
+         Debug("%s: Failed to set the file permissions\n", __FUNCTION__);
          goto abort;
       }
    }
@@ -5409,9 +5409,9 @@ VixToolsSetFileAttributes(VixCommandRequestHeader *requestMsg)    // IN
          ownerId = statbuf.st_uid;
          groupId = statbuf.st_gid;
       } else {
+         err = FoundryToolsDaemon_TranslateSystemErr();
          Debug("%s: Posix_Stat(%s) failed with %d\n",
                __FUNCTION__, filePathName, errno);
-         err = FoundryToolsDaemon_TranslateSystemErr();
          goto abort;
       }
 
@@ -5424,8 +5424,8 @@ VixToolsSetFileAttributes(VixCommandRequestHeader *requestMsg)    // IN
       }
 
       if (Posix_Chown(filePathName, ownerId, groupId)) {
-         Debug("%s: Failed to set the owner/group Id\n", __FUNCTION__);
          err = FoundryToolsDaemon_TranslateSystemErr();
+         Debug("%s: Failed to set the owner/group Id\n", __FUNCTION__);
          goto abort;
       }
    }
@@ -7459,9 +7459,9 @@ VixToolsDoesUsernameMatchCurrentUser(const char *username)  // IN
                                 &processToken);
 
       if (!retVal || !processToken) {
+         err = FoundryToolsDaemon_TranslateSystemErr();
          Warning("unable to open process token: windows error code %d\n",
                  GetLastError());
-         err = FoundryToolsDaemon_TranslateSystemErr();
 
          goto abort;
       }
@@ -7474,9 +7474,10 @@ VixToolsDoesUsernameMatchCurrentUser(const char *username)  // IN
                           &processTokenInfoSize);
 
       if (ERROR_INSUFFICIENT_BUFFER != GetLastError()) {
+         err = FoundryToolsDaemon_TranslateSystemErr();
          Warning("unable to get token info: windows error code %d\n",
                  GetLastError());
-         err = FoundryToolsDaemon_TranslateSystemErr();
+
          goto abort;
       }
 
@@ -7487,9 +7488,10 @@ VixToolsDoesUsernameMatchCurrentUser(const char *username)  // IN
                                processTokenInfo,
                                processTokenInfoSize,
                                &processTokenInfoSize)) {
+         err = FoundryToolsDaemon_TranslateSystemErr();
          Warning("unable to get token info: windows error code %d\n",
                  GetLastError());
-         err = FoundryToolsDaemon_TranslateSystemErr();
+
          goto abort;
       }
 
@@ -7503,9 +7505,9 @@ VixToolsDoesUsernameMatchCurrentUser(const char *username)  // IN
                               &sidNameUse);
 
       if (ERROR_INSUFFICIENT_BUFFER != GetLastError()) {
+         err = FoundryToolsDaemon_TranslateSystemErr();
          Warning("unable to lookup account sid: windows error code %d\n",
                  GetLastError());
-         err = FoundryToolsDaemon_TranslateSystemErr();
          goto abort;
       }
 
@@ -7519,9 +7521,9 @@ VixToolsDoesUsernameMatchCurrentUser(const char *username)  // IN
                                    sidDomainName,
                                    &sidDomainNameSize,
                                    &sidNameUse)) {
+         err = FoundryToolsDaemon_TranslateSystemErr();
          Warning("unable to lookup account sid: windows error code %d\n",
                  GetLastError());
-         err = FoundryToolsDaemon_TranslateSystemErr();
          goto abort;
      }