1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
2 /* Copyright (C) 2017-2018 Netronome Systems, Inc. */
7 #include <linux/bitops.h>
8 #include <linux/types.h>
11 /* Kernel's enum bpf_reg_type is not uABI so people may change it breaking
12 * our FW ABI. In that case we will do translation in the driver.
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
19 enum 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 NFP_BPF_CAP_TYPE_CMSG_MULTI_ENT
= 8,
30 struct nfp_bpf_cap_tlv_func
{
35 struct nfp_bpf_cap_tlv_adjust_head
{
39 __le32 guaranteed_sub
;
40 __le32 guaranteed_add
;
43 #define NFP_BPF_ADJUST_HEAD_NO_META BIT(0)
45 struct nfp_bpf_cap_tlv_maps
{
55 * Types defined for map related control messages
58 /* BPF ABIv2 fixed-length control message fields */
59 #define CMSG_MAP_KEY_LW 16
60 #define CMSG_MAP_VALUE_LW 16
62 enum nfp_bpf_cmsg_status
{
64 CMSG_RC_ERR_MAP_FD
= 1,
65 CMSG_RC_ERR_MAP_NOENT
= 2,
66 CMSG_RC_ERR_MAP_ERR
= 3,
67 CMSG_RC_ERR_MAP_PARSE
= 4,
68 CMSG_RC_ERR_MAP_EXIST
= 5,
69 CMSG_RC_ERR_MAP_NOMEM
= 6,
70 CMSG_RC_ERR_MAP_E2BIG
= 7,
73 struct cmsg_reply_map_simple
{
74 struct nfp_ccm_hdr hdr
;
78 struct cmsg_req_map_alloc_tbl
{
79 struct nfp_ccm_hdr hdr
;
80 __be32 key_size
; /* in bytes */
81 __be32 value_size
; /* in bytes */
84 __be32 map_flags
; /* reserved */
87 struct cmsg_reply_map_alloc_tbl
{
88 struct cmsg_reply_map_simple reply_hdr
;
92 struct cmsg_req_map_free_tbl
{
93 struct nfp_ccm_hdr hdr
;
97 struct cmsg_reply_map_free_tbl
{
98 struct cmsg_reply_map_simple reply_hdr
;
102 struct cmsg_req_map_op
{
103 struct nfp_ccm_hdr hdr
;
110 struct cmsg_reply_map_op
{
111 struct cmsg_reply_map_simple reply_hdr
;
117 struct cmsg_bpf_event
{
118 struct nfp_ccm_hdr hdr
;