return NULL;
}
- buf = malloc(paddedSize);
+ buf = (void **)malloc(paddedSize);
if (!buf) {
return NULL;
}
VIX_PROPERTY_VM_VMTEAM_PATHNAME = 105,
VIX_PROPERTY_VM_MEMORY_SIZE = 106,
VIX_PROPERTY_VM_READ_ONLY = 107,
+ VIX_PROPERTY_VM_NAME = 108,
+ VIX_PROPERTY_VM_GUESTOS = 109,
VIX_PROPERTY_VM_IN_VMTEAM = 128,
VIX_PROPERTY_VM_POWER_STATE = 129,
VIX_PROPERTY_VM_TOOLS_STATE = 152,
FLAGDEF( 6, EAX, INTEL, 0, 1, THERMAL_SENSOR, NA, FALSE) \
FLAGDEF( 6, EAX, INTEL, 1, 1, TURBO_MODE, NA, FALSE) \
FIELDDEF( 6, EBX, INTEL, 0, 4, NUM_INTR_THRESHOLDS, NA, FALSE) \
-FLAGDEF( 6, ECX, INTEL, 0, 1, HW_COORD_FEEDBACK, NA, FALSE)
+FLAGDEF( 6, ECX, INTEL, 0, 1, HW_COORD_FEEDBACK, NA, FALSE) \
+FLAGDEF( 6, ECX, INTEL, 3, 1, ENERGY_PERF_BIAS, NA, FALSE)
/* LEVEL, REG, VENDOR, POS, SIZE, NAME, MON SUPP, CPL3, [FUNC] */
#define CPUID_FIELD_DATA_LEVEL_A \
FLAGDEF( 8A, EDX, AMD, 1, 1, SVM_LBR, NO, FALSE) \
FLAGDEF( 8A, EDX, AMD, 2, 1, SVM_LOCK, NO, FALSE) \
FLAGDEF( 8A, EDX, AMD, 3, 1, SVM_NRIP, NO, FALSE) \
-FIELDDEF( 8A, EDX, AMD, 4, 28, SVMEDX_RSVD, NO, FALSE)
+FLAGDEF( 8A, EDX, AMD, 10, 1, SVM_PAUSE_FILTER, NO, FALSE)
+
+
+
+#define CPUID_FIELD_DATA_LEVEL_8A_BD \
+FIELDDEF( 8A, EDX, AMD, 4, 6, SVMEDX_RSVD0, NO, FALSE) \
+FIELDDEF( 8A, EDX, AMD, 11, 21, SVMEDX_RSVD1, NO, FALSE)
+
+
#define CPUID_FIELD_DATA \
CPUID_FIELD_DATA_LEVEL_B \
CPUID_FIELD_DATA_LEVEL_80 \
CPUID_FIELD_DATA_LEVEL_81 \
- CPUID_FIELD_DATA_LEVEL_8x
+ CPUID_FIELD_DATA_LEVEL_8x \
+ CPUID_FIELD_DATA_LEVEL_8A_BD
/*
{ [0 ... VMXNET3_SHM_MAX_DEVICES] = -1 };
static char *shm_disclaimer = NULL;
static int correct_shm_disclaimer;
+static int shm_pool_size = SHM_DEFAULT_DATA_SIZE;
#define VMXNET3_SHM_DISCLAIMER "IReallyWantThisModeIAmAVMwarePartner"
/*
if (adapter->is_shm) {
printk(KERN_INFO "bringing up shared memory vmxnet3 %s\n",
netdev->name);
- err = vmxnet3_shm_open(adapter, netdev->name);
+ err = vmxnet3_shm_open(adapter, netdev->name, shm_pool_size);
if (err) {
goto shm_err;
}
MODULE_PARM_DESC(enable_shm, "Shared memory enable");
module_param(shm_disclaimer, charp, 0);
MODULE_PARM_DESC(shm_disclaimer, "Shared memory disclaimer");
+module_param(shm_pool_size, int, 0);
+MODULE_PARM_DESC(shm_pool_size, "Shared memory pool size");
BUG_ON(i == SHM_INVALID_IDX);
}
- BUG_ON(shm->allocator.count > SHM_DATA_SIZE);
+ BUG_ON(shm->allocator.count > shm->data.num_pages);
}
struct vmxnet3_shm_pool *
vmxnet3_shm_pool_create(struct vmxnet3_adapter *adapter,
- char *name)
+ char *name, int pool_size)
{
int i;
unsigned long flags;
struct vmxnet3_shm_pool *shm;
struct vmxnet3_shm_ctl *ctl_ptr;
struct page *ctl_page;
+ int shm_size = sizeof(*shm) +
+ pool_size * sizeof(uint16) +
+ pool_size * sizeof(struct vmxnet3_shm_mapped_page);
/* Allocate shm_pool kobject */
- shm = kmalloc(sizeof(*shm), GFP_KERNEL);
+ shm = vmalloc(shm_size);
if (shm == NULL)
goto fail_shm;
shm->adapter = adapter;
/* Allocate data pages */
- shm->data.num_pages = SHM_DATA_SIZE;
+ shm->data.num_pages = pool_size;
for (i = 1; i < shm->data.num_pages; i++) {
struct page *page = alloc_page(GFP_KERNEL);
if (page == NULL)
}
/* Free data pages */
- for (i = 1; i < SHM_DATA_SIZE; i++)
+ for (i = 1; i < shm->data.num_pages; i++)
__free_page(VMXNET3_SHM_IDX2PAGE(shm, i));
- kfree(shm);
-
printk(KERN_INFO "destroyed vmxnet shared memory pool %s\n", shm->name);
+
+ vfree(shm);
}
unsigned long flags;
spin_lock_irqsave(&shm->alloc_lock, flags);
- BUG_ON(shm->allocator.count >= SHM_DATA_SIZE);
+ BUG_ON(shm->allocator.count >= shm->data.num_pages);
shm->allocator.stack[shm->allocator.count++] = idx;
spin_unlock_irqrestore(&shm->alloc_lock, flags);
}
unsigned long idx = vmxnet3_shm_addr2idx(vma, address);
struct page *pageptr;
- if (idx >= SHM_DATA_START && idx < SHM_DATA_START + SHM_DATA_SIZE)
+ if (idx >= SHM_DATA_START && idx < SHM_DATA_START + shm->data.num_pages)
pageptr = VMXNET3_SHM_IDX2PAGE(shm, idx - SHM_DATA_START);
else if (idx >= SHM_CTL_START && idx < SHM_CTL_START + SHM_CTL_SIZE)
pageptr = shm->ctl.pages[idx - SHM_CTL_START];
unsigned long idx = vmxnet3_shm_addr2idx(vma, address);
struct page *pageptr;
- if (idx >= SHM_DATA_START && idx < SHM_DATA_START + SHM_DATA_SIZE)
+ if (idx >= SHM_DATA_START && idx < SHM_DATA_START + shm->data.num_pages)
pageptr = VMXNET3_SHM_IDX2PAGE(shm, idx - SHM_DATA_START);
else if (idx >= SHM_CTL_START && idx < SHM_CTL_START + SHM_CTL_SIZE)
pageptr = shm->ctl.pages[idx - SHM_CTL_START];
unsigned long idx = vmxnet3_shm_addr2idx(vma, address);
struct page *pageptr;
- if (idx >= SHM_DATA_START && idx < SHM_DATA_START + SHM_DATA_SIZE)
+ if (idx >= SHM_DATA_START && idx < SHM_DATA_START + shm->data.num_pages)
pageptr = VMXNET3_SHM_IDX2PAGE(shm, idx - SHM_DATA_START);
else if (idx >= SHM_CTL_START && idx < SHM_CTL_START + SHM_CTL_SIZE)
pageptr = shm->ctl.pages[idx - SHM_CTL_START];
return idx1;
case SHM_IOCTL_FREE_ONE:
- if (arg != SHM_INVALID_IDX && arg < SHM_DATA_SIZE)
+ if (arg != SHM_INVALID_IDX && arg < shm->data.num_pages)
vmxnet3_shm_free_page(shm, arg);
return 0;
int
vmxnet3_shm_open(struct vmxnet3_adapter *adapter,
- char *name)
+ char *name, int pool_size)
{
- adapter->shm = vmxnet3_shm_pool_create(adapter, name);
+ if (pool_size > SHM_MAX_DATA_SIZE) {
+ printk(KERN_ERR "vmxnet3_shm: requested pool size %d is larger than the maximum %d\n",
+ pool_size, SHM_MAX_DATA_SIZE);
+ return -EINVAL;
+ }
+
+ adapter->shm = vmxnet3_shm_pool_create(adapter, name, pool_size);
if (adapter->shm == NULL) {
printk(KERN_ERR "failed to create shared memory pool\n");
return -ENOMEM;
struct
{
/* pages backing the map in virtual address order */
- struct vmxnet3_shm_mapped_page pages[SHM_DATA_SIZE];
+ struct vmxnet3_shm_mapped_page *pages;
unsigned int num_pages;
} data;
* count - 1 is the topmost free page.
*/
u16 count;
- u16 stack[SHM_DATA_SIZE];
+ u16 *stack;
} allocator;
struct
int
vmxnet3_shm_close(struct vmxnet3_adapter *adapter);
int
-vmxnet3_shm_open(struct vmxnet3_adapter *adapter, char *name);
+vmxnet3_shm_open(struct vmxnet3_adapter *adapter, char *name, int pool_size);
int
vmxnet3_shm_user_rx(struct vmxnet3_shm_pool *shm,
u16 idx, u16 len,
// sizes of shared memory regions in pages
#define SHM_DATA_START 0
-#define SHM_DATA_SIZE 4096
+#define SHM_DEFAULT_DATA_SIZE 4096
+#define SHM_MAX_DATA_SIZE 16384
#define SHM_CTL_START 16384
#define SHM_CTL_SIZE 1
#ifndef _VMXNET3_VERSION_H_
#define _VMXNET3_VERSION_H_
-#define VMXNET3_DRIVER_VERSION 1.0.4.0
-#define VMXNET3_DRIVER_VERSION_COMMAS 1,0,4,0
-#define VMXNET3_DRIVER_VERSION_STRING "1.0.4.0"
+#define VMXNET3_DRIVER_VERSION 1.0.5.0
+#define VMXNET3_DRIVER_VERSION_COMMAS 1,0,5,0
+#define VMXNET3_DRIVER_VERSION_STRING "1.0.5.0"
/* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */
-#define VMXNET3_DRIVER_VERSION_NUM 0x01000400
+#define VMXNET3_DRIVER_VERSION_NUM 0x01000500
#endif /* _VMXNET3_VERSION_H_ */
*
* utf::string::replace --
*
- * Replace all occurences of the given string with another string.
+ * Mutates this string by replacing all occurrences of one string with
+ * another.
*
* Results:
- * A utf::string created with the substring replaced.
+ * A reference to this object.
*
* Side effects:
* None
}
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * utf::string::replace_copy --
+ *
+ * Results:
+ * Returns a new string with all occurrences of one string replaced by
+ * another.
+ *
+ * Side effects:
+ * None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+string
+string::replace_copy(const string& from, // IN
+ const string& to) // IN
+ const
+{
+ return string(*this).replace(from, to);
+}
+
+
/*
*-----------------------------------------------------------------------------
*
*
* utf::string::find_first_of --
*
- * Find the first occurence of 's' in this string. 'i' determines where in
+ * Find the first occurrence of 's' in this string. 'i' determines where in
* the current string we start searching for 's'
*
* Results:
*
* utf::string::find_first_not_of --
*
- * Find the first occurence of a string NOT in 's' in this string. 'i'
+ * Find the first occurrence of a string NOT in 's' in this string. 'i'
* determines where in this string we start searching to NOT 's'.
*
* Results:
iterator erase(iterator pbegin, iterator pend);
string& replace(size_type i, size_type n, const string& s);
string& replace(const string &from, const string &to);
+ string replace_copy(const string& from, const string& to) const;
int compare(const string &s, bool ignoreCase = false) const;
int compare(size_type i, size_type n, const string &s) const;