1
2
3
4#ifndef NFP_BPF_FW_H
5#define NFP_BPF_FW_H 1
6
7#include <linux/bitops.h>
8#include <linux/types.h>
9#include "../ccm.h"
10
11
12
13
14#define NFP_BPF_SCALAR_VALUE 1
15#define NFP_BPF_MAP_VALUE 4
16#define NFP_BPF_STACK 6
17#define NFP_BPF_PACKET_DATA 8
18
19enum bpf_cap_tlv_type {
20 NFP_BPF_CAP_TYPE_FUNC = 1,
21 NFP_BPF_CAP_TYPE_ADJUST_HEAD = 2,
22 NFP_BPF_CAP_TYPE_MAPS = 3,
23 NFP_BPF_CAP_TYPE_RANDOM = 4,
24 NFP_BPF_CAP_TYPE_QUEUE_SELECT = 5,
25 NFP_BPF_CAP_TYPE_ADJUST_TAIL = 6,
26 NFP_BPF_CAP_TYPE_ABI_VERSION = 7,
27};
28
29struct nfp_bpf_cap_tlv_func {
30 __le32 func_id;
31 __le32 func_addr;
32};
33
34struct nfp_bpf_cap_tlv_adjust_head {
35 __le32 flags;
36 __le32 off_min;
37 __le32 off_max;
38 __le32 guaranteed_sub;
39 __le32 guaranteed_add;
40};
41
42#define NFP_BPF_ADJUST_HEAD_NO_META BIT(0)
43
44struct nfp_bpf_cap_tlv_maps {
45 __le32 types;
46 __le32 max_maps;
47 __le32 max_elems;
48 __le32 max_key_sz;
49 __le32 max_val_sz;
50 __le32 max_elem_sz;
51};
52
53
54
55
56
57
58#define CMSG_MAP_KEY_LW 16
59#define CMSG_MAP_VALUE_LW 16
60
61enum nfp_bpf_cmsg_status {
62 CMSG_RC_SUCCESS = 0,
63 CMSG_RC_ERR_MAP_FD = 1,
64 CMSG_RC_ERR_MAP_NOENT = 2,
65 CMSG_RC_ERR_MAP_ERR = 3,
66 CMSG_RC_ERR_MAP_PARSE = 4,
67 CMSG_RC_ERR_MAP_EXIST = 5,
68 CMSG_RC_ERR_MAP_NOMEM = 6,
69 CMSG_RC_ERR_MAP_E2BIG = 7,
70};
71
72struct cmsg_reply_map_simple {
73 struct nfp_ccm_hdr hdr;
74 __be32 rc;
75};
76
77struct cmsg_req_map_alloc_tbl {
78 struct nfp_ccm_hdr hdr;
79 __be32 key_size;
80 __be32 value_size;
81 __be32 max_entries;
82 __be32 map_type;
83 __be32 map_flags;
84};
85
86struct cmsg_reply_map_alloc_tbl {
87 struct cmsg_reply_map_simple reply_hdr;
88 __be32 tid;
89};
90
91struct cmsg_req_map_free_tbl {
92 struct nfp_ccm_hdr hdr;
93 __be32 tid;
94};
95
96struct cmsg_reply_map_free_tbl {
97 struct cmsg_reply_map_simple reply_hdr;
98 __be32 count;
99};
100
101struct cmsg_req_map_op {
102 struct nfp_ccm_hdr hdr;
103 __be32 tid;
104 __be32 count;
105 __be32 flags;
106 u8 data[0];
107};
108
109struct cmsg_reply_map_op {
110 struct cmsg_reply_map_simple reply_hdr;
111 __be32 count;
112 __be32 resv;
113 u8 data[0];
114};
115
116struct cmsg_bpf_event {
117 struct nfp_ccm_hdr hdr;
118 __be32 cpu_id;
119 __be64 map_ptr;
120 __be32 data_size;
121 __be32 pkt_size;
122 u8 data[0];
123};
124#endif
125