#ifndef __BPF_SYS__ #define __BPF_SYS__ #include #include #include #include static inline __u64 bpf_ptr_to_u64(const void *ptr) { return (__u64)(unsigned long) ptr; } static inline int bpf(int cmd, union bpf_attr *attr, unsigned int size) { #ifdef __NR_bpf return syscall(__NR_bpf, cmd, attr, size); #else fprintf(stderr, "No bpf syscall, kernel headers too old?\n"); errno = ENOSYS; return -1; #endif } static inline int bpf_map_lookup(int fd, const void *key, void *value) { union bpf_attr attr = {}; attr.map_fd = fd; attr.key = bpf_ptr_to_u64(key); attr.value = bpf_ptr_to_u64(value); return bpf(BPF_MAP_LOOKUP_ELEM, &attr, sizeof(attr)); } static inline int bpf_map_update(int fd, const void *key, const void *value, uint64_t flags) { union bpf_attr attr = {}; attr.map_fd = fd; attr.key = bpf_ptr_to_u64(key); attr.value = bpf_ptr_to_u64(value); attr.flags = flags; return bpf(BPF_MAP_UPDATE_ELEM, &attr, sizeof(attr)); } static inline int bpf_map_delete(int fd, const void *key) { union bpf_attr attr = {}; attr.map_fd = fd; attr.key = bpf_ptr_to_u64(key); return bpf(BPF_MAP_DELETE_ELEM, &attr, sizeof(attr)); } static inline int bpf_map_next_key(int fd, const void *key, void *next_key) { union bpf_attr attr = {}; attr.map_fd = fd; attr.key = bpf_ptr_to_u64(key); attr.next_key = bpf_ptr_to_u64(next_key); return bpf(BPF_MAP_GET_NEXT_KEY, &attr, sizeof(attr)); } static inline int bpf_map_create(enum bpf_map_type type, uint32_t size_key, uint32_t size_value, uint32_t max_elem, uint32_t flags) { union bpf_attr attr = {}; attr.map_type = type; attr.key_size = size_key; attr.value_size = size_value; attr.max_entries = max_elem; attr.map_flags = flags; return bpf(BPF_MAP_CREATE, &attr, sizeof(attr)); } static inline int bpf_prog_load(enum bpf_prog_type type, const struct bpf_insn *insns, size_t size_insns, const char *license, char *log, size_t size_log) { union bpf_attr attr = {}; attr.prog_type = type; attr.insns = bpf_ptr_to_u64(insns); attr.insn_cnt = size_insns / sizeof(struct bpf_insn); attr.license = bpf_ptr_to_u64(license); if (size_log > 0) { attr.log_buf = bpf_ptr_to_u64(log); attr.log_size = size_log; attr.log_level = 1; log[0] = 0; } return bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); } #endif /* __BPF_SYS__ */ tion value='grep'>log msg
diff options
context:
space:
mode:
authorJack Morgenstein <jackm@dev.mellanox.co.il>2017-01-15 20:15:00 +0200
committerDoug Ledford <dledford@redhat.com>2017-01-27 14:29:04 -0500
commitb4cfe3971f6eab542dd7ecc398bfa1aeec889934 (patch)
treec7ad49d05da0535170c8e7710cd44ae1cecc271f /net/rose/sysctl_net_rose.c
parent2d4b21e0a2913612274a69a3ba1bfee4cffc6e77 (diff)
RDMA/cma: Fix unknown symbol when CONFIG_IPV6 is not enabled
If IPV6 has not been enabled in the underlying kernel, we must avoid calling IPV6 procedures in rdma_cm.ko. This requires using "IS_ENABLED(CONFIG_IPV6)" in "if" statements surrounding any code which calls external IPV6 procedures. In the instance fixed here, procedure cma_bind_addr() called ipv6_addr_type() -- which resulted in calling external procedure __ipv6_addr_type(). Fixes: 6c26a77124ff ("RDMA/cma: fix IPv6 address resolution") Cc: <stable@vger.kernel.org> # v4.2+ Cc: Spencer Baugh <sbaugh@catern.com> Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il> Reviewed-by: Moni Shoua <monis@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'net/rose/sysctl_net_rose.c')