git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ethdev: add a missing sanity check for Tx queue setup
[dpdk.git]
/
lib
/
librte_ivshmem
/
rte_ivshmem.c
diff --git
a/lib/librte_ivshmem/rte_ivshmem.c
b/lib/librte_ivshmem/rte_ivshmem.c
index
ae63bb9
..
8fc4b57
100644
(file)
--- a/
lib/librte_ivshmem/rte_ivshmem.c
+++ b/
lib/librte_ivshmem/rte_ivshmem.c
@@
-229,7
+229,7
@@
get_hugefile_by_virt_addr(uint64_t virt_addr, struct memseg_cache_entry * e)
}
/* calculate offset and copy the file path */
}
/* calculate offset and copy the file path */
-
rte_
snprintf(e->filepath, RTE_PTR_DIFF(path_end, start) + 1, "%s", start);
+ snprintf(e->filepath, RTE_PTR_DIFF(path_end, start) + 1, "%s", start);
e->offset = virt_addr - start_addr;
e->offset = virt_addr - start_addr;
@@
-377,6
+377,8
@@
build_config(struct rte_ivshmem_metadata * metadata)
for (j = biggest_idx - 1; j >= i; j--) {
memcpy(&pages[j+1], &pages[j], sizeof(struct rte_memseg));
memset(&pages[j], 0, sizeof(struct rte_memseg));
for (j = biggest_idx - 1; j >= i; j--) {
memcpy(&pages[j+1], &pages[j], sizeof(struct rte_memseg));
memset(&pages[j], 0, sizeof(struct rte_memseg));
+ if (j == 0)
+ break;
}
/* put old biggest segment to its new place */
}
/* put old biggest segment to its new place */
@@
-502,7
+504,22
@@
add_memzone_to_metadata(const struct rte_memzone * mz,
config->metadata->name);
goto fail;
}
config->metadata->name);
goto fail;
}
+#ifdef RTE_LIBRTE_IVSHMEM
+ struct rte_mem_config *mcfg;
+ unsigned int idx;
+
+ mcfg = rte_eal_get_configuration()->mem_config;
+
+ rte_rwlock_write_lock(&mcfg->mlock);
+ idx = ((uintptr_t)mz - (uintptr_t)mcfg->memzone);
+ idx = idx / sizeof(struct rte_memzone);
+
+ /* mark the memzone not freeable */
+ mcfg->memzone[idx].ioremap_addr = mz->phys_addr;
+
+ rte_rwlock_write_unlock(&mcfg->mlock);
+#endif
rte_spinlock_unlock(&config->sl);
return 0;
fail:
rte_spinlock_unlock(&config->sl);
return 0;
fail:
@@
-606,7
+623,7
@@
rte_ivshmem_metadata_add_mempool(const struct rte_mempool * mp, const char * nam
static inline void
ivshmem_config_path(char *buffer, size_t bufflen, const char *name)
{
static inline void
ivshmem_config_path(char *buffer, size_t bufflen, const char *name)
{
-
rte_
snprintf(buffer, bufflen, IVSHMEM_CONFIG_FILE_FMT, name);
+ snprintf(buffer, bufflen, IVSHMEM_CONFIG_FILE_FMT, name);
}
}
@@
-707,7
+724,7
@@
int rte_ivshmem_metadata_create(const char *name)
/* Metadata setup */
memset(ivshmem_config->metadata, 0, sizeof(struct rte_ivshmem_metadata));
ivshmem_config->metadata->magic_number = IVSHMEM_MAGIC;
/* Metadata setup */
memset(ivshmem_config->metadata, 0, sizeof(struct rte_ivshmem_metadata));
ivshmem_config->metadata->magic_number = IVSHMEM_MAGIC;
-
rte_
snprintf(ivshmem_config->metadata->name,
+ snprintf(ivshmem_config->metadata->name,
sizeof(ivshmem_config->metadata->name), "%s", name);
rte_spinlock_unlock(&global_cfg_sl);
sizeof(ivshmem_config->metadata->name), "%s", name);
rte_spinlock_unlock(&global_cfg_sl);
@@
-738,7
+755,7
@@
rte_ivshmem_metadata_cmdline_generate(char *buffer, unsigned size, const char *n
rte_spinlock_lock(&config->sl);
/* prepare metadata file path */
rte_spinlock_lock(&config->sl);
/* prepare metadata file path */
-
rte_
snprintf(cfg_file_path, sizeof(cfg_file_path), IVSHMEM_CONFIG_FILE_FMT,
+ snprintf(cfg_file_path, sizeof(cfg_file_path), IVSHMEM_CONFIG_FILE_FMT,
config->metadata->name);
ms_cache = config->memseg_cache;
config->metadata->name);
ms_cache = config->memseg_cache;
@@
-754,7
+771,7
@@
rte_ivshmem_metadata_cmdline_generate(char *buffer, unsigned size, const char *n
entry = &ms_cache[iter];
/* Offset and sizes within the current pathname */
entry = &ms_cache[iter];
/* Offset and sizes within the current pathname */
- tmplen =
rte_
snprintf(cmdline_ptr, remaining_len, IVSHMEM_QEMU_CMD_FD_FMT,
+ tmplen = snprintf(cmdline_ptr, remaining_len, IVSHMEM_QEMU_CMD_FD_FMT,
entry->filepath, entry->offset, entry->len);
shared_mem_size += entry->len;
entry->filepath, entry->offset, entry->len);
shared_mem_size += entry->len;
@@
-775,7
+792,7
@@
rte_ivshmem_metadata_cmdline_generate(char *buffer, unsigned size, const char *n
zero_size = total_size - shared_mem_size - METADATA_SIZE_ALIGNED;
/* add /dev/zero to command-line to fill the space */
zero_size = total_size - shared_mem_size - METADATA_SIZE_ALIGNED;
/* add /dev/zero to command-line to fill the space */
- tmplen =
rte_
snprintf(cmdline_ptr, remaining_len, IVSHMEM_QEMU_CMD_FD_FMT,
+ tmplen = snprintf(cmdline_ptr, remaining_len, IVSHMEM_QEMU_CMD_FD_FMT,
"/dev/zero",
(uint64_t)0x0,
zero_size);
"/dev/zero",
(uint64_t)0x0,
zero_size);
@@
-790,7
+807,7
@@
rte_ivshmem_metadata_cmdline_generate(char *buffer, unsigned size, const char *n
}
/* add metadata file to the end of command-line */
}
/* add metadata file to the end of command-line */
- tmplen =
rte_
snprintf(cmdline_ptr, remaining_len, IVSHMEM_QEMU_CMD_FD_FMT,
+ tmplen = snprintf(cmdline_ptr, remaining_len, IVSHMEM_QEMU_CMD_FD_FMT,
cfg_file_path,
(uint64_t)0x0,
METADATA_SIZE_ALIGNED);
cfg_file_path,
(uint64_t)0x0,
METADATA_SIZE_ALIGNED);
@@
-812,7
+829,7
@@
rte_ivshmem_metadata_cmdline_generate(char *buffer, unsigned size, const char *n
return -1;
}
/* complete the command-line */
return -1;
}
/* complete the command-line */
-
rte_
snprintf(buffer, size,
+ snprintf(buffer, size,
IVSHMEM_QEMU_CMD_LINE_HEADER_FMT,
total_size >> 20,
cmdline);
IVSHMEM_QEMU_CMD_LINE_HEADER_FMT,
total_size >> 20,
cmdline);