aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/linux/pci.c9
-rw-r--r--src/vlib/pci/pci.h1
-rwxr-xr-xsrc/vlib/physmem.c1
-rw-r--r--src/vlib/physmem.h1
-rw-r--r--src/vlib/physmem_funcs.h9
5 files changed, 21 insertions, 0 deletions
diff --git a/src/vlib/linux/pci.c b/src/vlib/linux/pci.c
index ed43580ffc0..b99f54f2a62 100644
--- a/src/vlib/linux/pci.c
+++ b/src/vlib/linux/pci.c
@@ -97,6 +97,7 @@ typedef struct
linux_pci_device_type_t type;
vlib_pci_dev_handle_t handle;
vlib_pci_addr_t addr;
+ u32 numa_node;
/* Resource file descriptors. */
linux_pci_region_t *regions;
@@ -165,6 +166,13 @@ vlib_pci_get_addr (vlib_main_t * vm, vlib_pci_dev_handle_t h)
return &d->addr;
}
+u32
+vlib_pci_get_numa_node (vlib_main_t * vm, vlib_pci_dev_handle_t h)
+{
+ linux_pci_device_t *d = linux_pci_get_device (h);
+ return d->numa_node;
+}
+
/* Call to allocate/initialize the pci subsystem.
This is not an init function so that users can explicitly enable
pci only when it's needed. */
@@ -1210,6 +1218,7 @@ vlib_pci_device_open (vlib_main_t * vm, vlib_pci_addr_t * addr,
p->handle = p - lpm->linux_pci_devices;
p->addr.as_u32 = di->addr.as_u32;
p->intx_irq.fd = -1;
+ p->numa_node = di->numa_node;
/*
* pci io bar read/write fd
*/
diff --git a/src/vlib/pci/pci.h b/src/vlib/pci/pci.h
index 1c70cc7bb80..71d4baedd20 100644
--- a/src/vlib/pci/pci.h
+++ b/src/vlib/pci/pci.h
@@ -102,6 +102,7 @@ vlib_pci_device_info_t *vlib_pci_get_device_info (vlib_main_t * vm,
vlib_pci_addr_t *vlib_pci_get_all_dev_addrs ();
vlib_pci_addr_t *vlib_pci_get_addr (vlib_main_t * vm,
vlib_pci_dev_handle_t h);
+u32 vlib_pci_get_numa_node (vlib_main_t * vm, vlib_pci_dev_handle_t h);
uword vlib_pci_get_private_data (vlib_main_t * vm, vlib_pci_dev_handle_t h);
void vlib_pci_set_private_data (vlib_main_t * vm, vlib_pci_dev_handle_t h,
uword private_data);
diff --git a/src/vlib/physmem.c b/src/vlib/physmem.c
index 37bf693f182..21fe44fc1ca 100755
--- a/src/vlib/physmem.c
+++ b/src/vlib/physmem.c
@@ -57,6 +57,7 @@ vlib_physmem_shared_map_create (vlib_main_t * vm, char *name, uword size,
map->fd = a->fd;
map->n_pages = a->n_pages * a->subpages_per_page;
map->log2_page_size = a->log2_subpage_sz;
+ map->numa_node = a->numa_node;
for (i = 0; i < a->n_pages; i++)
{
diff --git a/src/vlib/physmem.h b/src/vlib/physmem.h
index 3e73a1b03f0..a986a50b1cb 100644
--- a/src/vlib/physmem.h
+++ b/src/vlib/physmem.h
@@ -50,6 +50,7 @@ typedef struct
u32 n_pages;
uword *page_table;
u32 log2_page_size;
+ u32 numa_node;
} vlib_physmem_map_t;
typedef struct
diff --git a/src/vlib/physmem_funcs.h b/src/vlib/physmem_funcs.h
index 70fb8e74fc7..18daeebabd9 100644
--- a/src/vlib/physmem_funcs.h
+++ b/src/vlib/physmem_funcs.h
@@ -54,6 +54,15 @@ vlib_physmem_alloc_aligned (vlib_main_t * vm, uword n_bytes, uword alignment)
return clib_pmalloc_alloc_aligned (pm, n_bytes, alignment);
}
+always_inline void *
+vlib_physmem_alloc_aligned_on_numa (vlib_main_t * vm, uword n_bytes,
+ uword alignment, u32 numa_node)
+{
+ clib_pmalloc_main_t *pm = vm->physmem_main.pmalloc_main;
+ return clib_pmalloc_alloc_aligned_on_numa (pm, n_bytes, alignment,
+ numa_node);
+}
+
/* By default allocate I/O memory with cache line alignment. */
always_inline void *
vlib_physmem_alloc (vlib_main_t * vm, uword n_bytes)