diff options
Diffstat (limited to 'kernel/bpf/lpm_trie.c')
| -rw-r--r-- | kernel/bpf/lpm_trie.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c index b09185f0f17d..1b767844a76f 100644 --- a/kernel/bpf/lpm_trie.c +++ b/kernel/bpf/lpm_trie.c | |||
| @@ -244,7 +244,8 @@ static struct lpm_trie_node *lpm_trie_node_alloc(const struct lpm_trie *trie, | |||
| 244 | if (value) | 244 | if (value) |
| 245 | size += trie->map.value_size; | 245 | size += trie->map.value_size; |
| 246 | 246 | ||
| 247 | node = kmalloc(size, GFP_ATOMIC | __GFP_NOWARN); | 247 | node = kmalloc_node(size, GFP_ATOMIC | __GFP_NOWARN, |
| 248 | trie->map.numa_node); | ||
| 248 | if (!node) | 249 | if (!node) |
| 249 | return NULL; | 250 | return NULL; |
| 250 | 251 | ||
| @@ -405,6 +406,8 @@ static int trie_delete_elem(struct bpf_map *map, void *key) | |||
| 405 | #define LPM_KEY_SIZE_MAX LPM_KEY_SIZE(LPM_DATA_SIZE_MAX) | 406 | #define LPM_KEY_SIZE_MAX LPM_KEY_SIZE(LPM_DATA_SIZE_MAX) |
| 406 | #define LPM_KEY_SIZE_MIN LPM_KEY_SIZE(LPM_DATA_SIZE_MIN) | 407 | #define LPM_KEY_SIZE_MIN LPM_KEY_SIZE(LPM_DATA_SIZE_MIN) |
| 407 | 408 | ||
| 409 | #define LPM_CREATE_FLAG_MASK (BPF_F_NO_PREALLOC | BPF_F_NUMA_NODE) | ||
| 410 | |||
| 408 | static struct bpf_map *trie_alloc(union bpf_attr *attr) | 411 | static struct bpf_map *trie_alloc(union bpf_attr *attr) |
| 409 | { | 412 | { |
| 410 | struct lpm_trie *trie; | 413 | struct lpm_trie *trie; |
| @@ -416,7 +419,8 @@ static struct bpf_map *trie_alloc(union bpf_attr *attr) | |||
| 416 | 419 | ||
| 417 | /* check sanity of attributes */ | 420 | /* check sanity of attributes */ |
| 418 | if (attr->max_entries == 0 || | 421 | if (attr->max_entries == 0 || |
| 419 | attr->map_flags != BPF_F_NO_PREALLOC || | 422 | !(attr->map_flags & BPF_F_NO_PREALLOC) || |
| 423 | attr->map_flags & ~LPM_CREATE_FLAG_MASK || | ||
| 420 | attr->key_size < LPM_KEY_SIZE_MIN || | 424 | attr->key_size < LPM_KEY_SIZE_MIN || |
| 421 | attr->key_size > LPM_KEY_SIZE_MAX || | 425 | attr->key_size > LPM_KEY_SIZE_MAX || |
| 422 | attr->value_size < LPM_VAL_SIZE_MIN || | 426 | attr->value_size < LPM_VAL_SIZE_MIN || |
| @@ -433,6 +437,7 @@ static struct bpf_map *trie_alloc(union bpf_attr *attr) | |||
| 433 | trie->map.value_size = attr->value_size; | 437 | trie->map.value_size = attr->value_size; |
| 434 | trie->map.max_entries = attr->max_entries; | 438 | trie->map.max_entries = attr->max_entries; |
| 435 | trie->map.map_flags = attr->map_flags; | 439 | trie->map.map_flags = attr->map_flags; |
| 440 | trie->map.numa_node = bpf_map_attr_numa_node(attr); | ||
| 436 | trie->data_size = attr->key_size - | 441 | trie->data_size = attr->key_size - |
| 437 | offsetof(struct bpf_lpm_trie_key, data); | 442 | offsetof(struct bpf_lpm_trie_key, data); |
| 438 | trie->max_prefixlen = trie->data_size * 8; | 443 | trie->max_prefixlen = trie->data_size * 8; |
