env: add a name for special "any socket ID" value
Change-Id: I1f339ee5ff80eee9cf7d6378daa71e2f59c158b2 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
4440cd8d28
commit
4c55092882
@ -47,6 +47,8 @@ extern "C" {
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define SPDK_ENV_SOCKET_ID_ANY (-1)
|
||||
|
||||
struct spdk_pci_device;
|
||||
|
||||
/**
|
||||
@ -78,7 +80,7 @@ void spdk_free(void *buf);
|
||||
* socket_id and flags.
|
||||
* Return a pointer to the allocated memory address. If the allocation
|
||||
* cannot be done, return NULL.
|
||||
* Note: to pick any socket id, just set socket_id to -1.
|
||||
* Note: to pick any socket id, just set socket_id to SPDK_ENV_SOCKET_ID_ANY.
|
||||
*/
|
||||
void *spdk_memzone_reserve(const char *name, size_t len, int socket_id, unsigned flags);
|
||||
|
||||
|
@ -82,7 +82,13 @@ spdk_free(void *buf)
|
||||
void *
|
||||
spdk_memzone_reserve(const char *name, size_t len, int socket_id, unsigned flags)
|
||||
{
|
||||
const struct rte_memzone *mz = rte_memzone_reserve(name, len, socket_id, flags);
|
||||
const struct rte_memzone *mz;
|
||||
|
||||
if (socket_id == SPDK_ENV_SOCKET_ID_ANY) {
|
||||
socket_id = SOCKET_ID_ANY;
|
||||
}
|
||||
|
||||
mz = rte_memzone_reserve(name, len, socket_id, flags);
|
||||
|
||||
if (mz != NULL) {
|
||||
memset(mz->addr, 0, len);
|
||||
|
Loading…
Reference in New Issue
Block a user