Lines Matching refs:key_p

528 	struct bpf_lpm_trie_key *key_p, *next_key_p;  in test_lpm_get_next_key()  local
533 key_size = sizeof(*key_p) + sizeof(__u32); in test_lpm_get_next_key()
534 key_p = alloca(key_size); in test_lpm_get_next_key()
542 assert(bpf_map_get_next_key(map_fd, NULL, key_p) == -1 && in test_lpm_get_next_key()
546 key_p->prefixlen = 16; in test_lpm_get_next_key()
547 inet_pton(AF_INET, "192.168.0.0", key_p->data); in test_lpm_get_next_key()
548 assert(bpf_map_update_elem(map_fd, key_p, &value, 0) == 0); in test_lpm_get_next_key()
550 memset(key_p, 0, key_size); in test_lpm_get_next_key()
551 assert(bpf_map_get_next_key(map_fd, NULL, key_p) == 0); in test_lpm_get_next_key()
552 assert(key_p->prefixlen == 16 && key_p->data[0] == 192 && in test_lpm_get_next_key()
553 key_p->data[1] == 168); in test_lpm_get_next_key()
555 assert(bpf_map_get_next_key(map_fd, key_p, next_key_p) == -1 && in test_lpm_get_next_key()
559 key_p->prefixlen = 8; in test_lpm_get_next_key()
560 assert(bpf_map_get_next_key(map_fd, NULL, key_p) == 0); in test_lpm_get_next_key()
561 assert(key_p->prefixlen == 16 && key_p->data[0] == 192 && in test_lpm_get_next_key()
562 key_p->data[1] == 168); in test_lpm_get_next_key()
565 key_p->prefixlen = 24; in test_lpm_get_next_key()
566 inet_pton(AF_INET, "192.168.0.0", key_p->data); in test_lpm_get_next_key()
567 assert(bpf_map_update_elem(map_fd, key_p, &value, 0) == 0); in test_lpm_get_next_key()
569 memset(key_p, 0, key_size); in test_lpm_get_next_key()
570 assert(bpf_map_get_next_key(map_fd, NULL, key_p) == 0); in test_lpm_get_next_key()
571 assert(key_p->prefixlen == 24 && key_p->data[0] == 192 && in test_lpm_get_next_key()
572 key_p->data[1] == 168 && key_p->data[2] == 0); in test_lpm_get_next_key()
575 assert(bpf_map_get_next_key(map_fd, key_p, next_key_p) == 0); in test_lpm_get_next_key()
579 memcpy(key_p, next_key_p, key_size); in test_lpm_get_next_key()
580 assert(bpf_map_get_next_key(map_fd, key_p, next_key_p) == -1 && in test_lpm_get_next_key()
584 key_p->prefixlen = 24; in test_lpm_get_next_key()
585 inet_pton(AF_INET, "192.168.128.0", key_p->data); in test_lpm_get_next_key()
586 assert(bpf_map_update_elem(map_fd, key_p, &value, 0) == 0); in test_lpm_get_next_key()
588 memset(key_p, 0, key_size); in test_lpm_get_next_key()
589 assert(bpf_map_get_next_key(map_fd, NULL, key_p) == 0); in test_lpm_get_next_key()
590 assert(key_p->prefixlen == 24 && key_p->data[0] == 192 && in test_lpm_get_next_key()
591 key_p->data[1] == 168 && key_p->data[2] == 0); in test_lpm_get_next_key()
594 assert(bpf_map_get_next_key(map_fd, key_p, next_key_p) == 0); in test_lpm_get_next_key()
598 memcpy(key_p, next_key_p, key_size); in test_lpm_get_next_key()
599 assert(bpf_map_get_next_key(map_fd, key_p, next_key_p) == 0); in test_lpm_get_next_key()
603 memcpy(key_p, next_key_p, key_size); in test_lpm_get_next_key()
604 assert(bpf_map_get_next_key(map_fd, key_p, next_key_p) == -1 && in test_lpm_get_next_key()
608 key_p->prefixlen = 24; in test_lpm_get_next_key()
609 inet_pton(AF_INET, "192.168.1.0", key_p->data); in test_lpm_get_next_key()
610 assert(bpf_map_update_elem(map_fd, key_p, &value, 0) == 0); in test_lpm_get_next_key()
612 memset(key_p, 0, key_size); in test_lpm_get_next_key()
613 assert(bpf_map_get_next_key(map_fd, NULL, key_p) == 0); in test_lpm_get_next_key()
614 assert(key_p->prefixlen == 24 && key_p->data[0] == 192 && in test_lpm_get_next_key()
615 key_p->data[1] == 168 && key_p->data[2] == 0); in test_lpm_get_next_key()
618 assert(bpf_map_get_next_key(map_fd, key_p, next_key_p) == 0); in test_lpm_get_next_key()
622 memcpy(key_p, next_key_p, key_size); in test_lpm_get_next_key()
623 assert(bpf_map_get_next_key(map_fd, key_p, next_key_p) == 0); in test_lpm_get_next_key()
627 memcpy(key_p, next_key_p, key_size); in test_lpm_get_next_key()
628 assert(bpf_map_get_next_key(map_fd, key_p, next_key_p) == 0); in test_lpm_get_next_key()
632 memcpy(key_p, next_key_p, key_size); in test_lpm_get_next_key()
633 assert(bpf_map_get_next_key(map_fd, key_p, next_key_p) == -1 && in test_lpm_get_next_key()
637 key_p->prefixlen = 22; in test_lpm_get_next_key()
638 inet_pton(AF_INET, "192.168.1.0", key_p->data); in test_lpm_get_next_key()
639 assert(bpf_map_get_next_key(map_fd, key_p, next_key_p) == 0); in test_lpm_get_next_key()
661 struct bpf_lpm_trie_key *key_p; in lpm_test_command() local
664 key_p = alloca(key_size); in lpm_test_command()
671 key_p->prefixlen = info->key[j].prefixlen; in lpm_test_command()
672 memcpy(key_p->data, &info->key[j].data, sizeof(__u32)); in lpm_test_command()
676 assert(bpf_map_update_elem(info->map_fd, key_p, &value, 0) == 0); in lpm_test_command()
678 ret = bpf_map_delete_elem(info->map_fd, key_p); in lpm_test_command()
682 ret = bpf_map_lookup_elem(info->map_fd, key_p, &value); in lpm_test_command()
686 ret = bpf_map_get_next_key(info->map_fd, key_p, next_key_p); in lpm_test_command()