X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_bpf%2Frte_bpf.h;h=ad62ef2c65cadfb705eac51f2b47fb8f42721ec0;hb=763e450ae24d88b87f1eb86643a2897b141d9c07;hp=1d6c4a9d22d8cc44ac34a501e76e36fd5a40a427;hpb=5dba93ae5f2dc38a13f373634bd06926716d150a;p=dpdk.git diff --git a/lib/librte_bpf/rte_bpf.h b/lib/librte_bpf/rte_bpf.h index 1d6c4a9d22..ad62ef2c65 100644 --- a/lib/librte_bpf/rte_bpf.h +++ b/lib/librte_bpf/rte_bpf.h @@ -6,7 +6,8 @@ #define _RTE_BPF_H_ /** - * @file + * @file rte_bpf.h + * @b EXPERIMENTAL: this API may change without prior notice * * RTE BPF support. * librte_bpf provides a framework to load and execute eBPF bytecode @@ -39,7 +40,11 @@ enum rte_bpf_arg_type { */ struct rte_bpf_arg { enum rte_bpf_arg_type type; - size_t size; /**< for pointer types, size of data it points to */ + /** + * for ptr type - max size of data buffer it points to + * for raw type - the size (in bytes) of the value + */ + size_t size; size_t buf_size; /**< for mbuf ptr type, max size of rte_mbuf data buffer */ }; @@ -65,10 +70,19 @@ struct rte_bpf_xsym { const char *name; /**< name */ enum rte_bpf_xtype type; /**< type */ union { - uint64_t (*func)(uint64_t, uint64_t, uint64_t, + struct { + uint64_t (*val)(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t); - void *var; - }; /**< value */ + uint32_t nb_args; + struct rte_bpf_arg args[EBPF_FUNC_MAX_ARGS]; + /**< Function arguments descriptions. */ + struct rte_bpf_arg ret; /**< function return value. */ + } func; + struct { + void *val; /**< actual memory location */ + struct rte_bpf_arg desc; /**< type, size, etc. */ + } var; /**< external variable */ + }; }; /** @@ -99,7 +113,8 @@ struct rte_bpf; * @param bpf * BPF handle to destroy. */ -void rte_bpf_destroy(struct rte_bpf *bpf); +void __rte_experimental +rte_bpf_destroy(struct rte_bpf *bpf); /** * Create a new eBPF execution context and load given BPF code into it. @@ -113,7 +128,8 @@ void rte_bpf_destroy(struct rte_bpf *bpf); * - EINVAL - invalid parameter passed to function * - ENOMEM - can't reserve enough memory */ -struct rte_bpf *rte_bpf_load(const struct rte_bpf_prm *prm); +struct rte_bpf * __rte_experimental +rte_bpf_load(const struct rte_bpf_prm *prm); /** * Create a new eBPF execution context and load BPF code from given ELF @@ -132,9 +148,9 @@ struct rte_bpf *rte_bpf_load(const struct rte_bpf_prm *prm); * - EINVAL - invalid parameter passed to function * - ENOMEM - can't reserve enough memory */ -struct rte_bpf *rte_bpf_elf_load(const struct rte_bpf_prm *prm, - const char *fname, const char *sname); - +struct rte_bpf * __rte_experimental +rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname, + const char *sname); /** * Execute given BPF bytecode. * @@ -145,7 +161,8 @@ struct rte_bpf *rte_bpf_elf_load(const struct rte_bpf_prm *prm, * @return * BPF execution return value. */ -uint64_t rte_bpf_exec(const struct rte_bpf *bpf, void *ctx); +uint64_t __rte_experimental +rte_bpf_exec(const struct rte_bpf *bpf, void *ctx); /** * Execute given BPF bytecode over a set of input contexts. @@ -161,8 +178,9 @@ uint64_t rte_bpf_exec(const struct rte_bpf *bpf, void *ctx); * @return * number of successfully processed inputs. */ -uint32_t rte_bpf_exec_burst(const struct rte_bpf *bpf, void *ctx[], - uint64_t rc[], uint32_t num); +uint32_t __rte_experimental +rte_bpf_exec_burst(const struct rte_bpf *bpf, void *ctx[], uint64_t rc[], + uint32_t num); /** * Provide information about natively compield code for given BPF handle. @@ -175,7 +193,8 @@ uint32_t rte_bpf_exec_burst(const struct rte_bpf *bpf, void *ctx[], * - -EINVAL if the parameters are invalid. * - Zero if operation completed successfully. */ -int rte_bpf_get_jit(const struct rte_bpf *bpf, struct rte_bpf_jit *jit); +int __rte_experimental +rte_bpf_get_jit(const struct rte_bpf *bpf, struct rte_bpf_jit *jit); #ifdef __cplusplus }