0001
0002
0003
0004 #ifndef NFP_BPF_FW_H
0005 #define NFP_BPF_FW_H 1
0006
0007 #include <linux/bitops.h>
0008 #include <linux/types.h>
0009 #include "../ccm.h"
0010
0011
0012
0013
0014 #define NFP_BPF_SCALAR_VALUE 1
0015 #define NFP_BPF_MAP_VALUE 4
0016 #define NFP_BPF_STACK 6
0017 #define NFP_BPF_PACKET_DATA 8
0018
0019 enum bpf_cap_tlv_type {
0020 NFP_BPF_CAP_TYPE_FUNC = 1,
0021 NFP_BPF_CAP_TYPE_ADJUST_HEAD = 2,
0022 NFP_BPF_CAP_TYPE_MAPS = 3,
0023 NFP_BPF_CAP_TYPE_RANDOM = 4,
0024 NFP_BPF_CAP_TYPE_QUEUE_SELECT = 5,
0025 NFP_BPF_CAP_TYPE_ADJUST_TAIL = 6,
0026 NFP_BPF_CAP_TYPE_ABI_VERSION = 7,
0027 NFP_BPF_CAP_TYPE_CMSG_MULTI_ENT = 8,
0028 };
0029
0030 struct nfp_bpf_cap_tlv_func {
0031 __le32 func_id;
0032 __le32 func_addr;
0033 };
0034
0035 struct nfp_bpf_cap_tlv_adjust_head {
0036 __le32 flags;
0037 __le32 off_min;
0038 __le32 off_max;
0039 __le32 guaranteed_sub;
0040 __le32 guaranteed_add;
0041 };
0042
0043 #define NFP_BPF_ADJUST_HEAD_NO_META BIT(0)
0044
0045 struct nfp_bpf_cap_tlv_maps {
0046 __le32 types;
0047 __le32 max_maps;
0048 __le32 max_elems;
0049 __le32 max_key_sz;
0050 __le32 max_val_sz;
0051 __le32 max_elem_sz;
0052 };
0053
0054
0055
0056
0057
0058
0059 #define CMSG_MAP_KEY_LW 16
0060 #define CMSG_MAP_VALUE_LW 16
0061
0062 enum nfp_bpf_cmsg_status {
0063 CMSG_RC_SUCCESS = 0,
0064 CMSG_RC_ERR_MAP_FD = 1,
0065 CMSG_RC_ERR_MAP_NOENT = 2,
0066 CMSG_RC_ERR_MAP_ERR = 3,
0067 CMSG_RC_ERR_MAP_PARSE = 4,
0068 CMSG_RC_ERR_MAP_EXIST = 5,
0069 CMSG_RC_ERR_MAP_NOMEM = 6,
0070 CMSG_RC_ERR_MAP_E2BIG = 7,
0071 };
0072
0073 struct cmsg_reply_map_simple {
0074 struct nfp_ccm_hdr hdr;
0075 __be32 rc;
0076 };
0077
0078 struct cmsg_req_map_alloc_tbl {
0079 struct nfp_ccm_hdr hdr;
0080 __be32 key_size;
0081 __be32 value_size;
0082 __be32 max_entries;
0083 __be32 map_type;
0084 __be32 map_flags;
0085 };
0086
0087 struct cmsg_reply_map_alloc_tbl {
0088 struct cmsg_reply_map_simple reply_hdr;
0089 __be32 tid;
0090 };
0091
0092 struct cmsg_req_map_free_tbl {
0093 struct nfp_ccm_hdr hdr;
0094 __be32 tid;
0095 };
0096
0097 struct cmsg_reply_map_free_tbl {
0098 struct cmsg_reply_map_simple reply_hdr;
0099 __be32 count;
0100 };
0101
0102 struct cmsg_req_map_op {
0103 struct nfp_ccm_hdr hdr;
0104 __be32 tid;
0105 __be32 count;
0106 __be32 flags;
0107 u8 data[];
0108 };
0109
0110 struct cmsg_reply_map_op {
0111 struct cmsg_reply_map_simple reply_hdr;
0112 __be32 count;
0113 __be32 resv;
0114 u8 data[];
0115 };
0116
0117 struct cmsg_bpf_event {
0118 struct nfp_ccm_hdr hdr;
0119 __be32 cpu_id;
0120 __be64 map_ptr;
0121 __be32 data_size;
0122 __be32 pkt_size;
0123 u8 data[];
0124 };
0125 #endif