forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/net/ethernet/netronome/nfp/bpf/fw.h
....@@ -1,41 +1,12 @@
1
-/*
2
- * Copyright (C) 2017-2018 Netronome Systems, Inc.
3
- *
4
- * This software is dual licensed under the GNU General License Version 2,
5
- * June 1991 as shown in the file COPYING in the top-level directory of this
6
- * source tree or the BSD 2-Clause License provided below. You have the
7
- * option to license this software under the complete terms of either license.
8
- *
9
- * The BSD 2-Clause License:
10
- *
11
- * Redistribution and use in source and binary forms, with or
12
- * without modification, are permitted provided that the following
13
- * conditions are met:
14
- *
15
- * 1. Redistributions of source code must retain the above
16
- * copyright notice, this list of conditions and the following
17
- * disclaimer.
18
- *
19
- * 2. Redistributions in binary form must reproduce the above
20
- * copyright notice, this list of conditions and the following
21
- * disclaimer in the documentation and/or other materials
22
- * provided with the distribution.
23
- *
24
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
- * SOFTWARE.
32
- */
1
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
2
+/* Copyright (C) 2017-2018 Netronome Systems, Inc. */
333
344 #ifndef NFP_BPF_FW_H
355 #define NFP_BPF_FW_H 1
366
377 #include <linux/bitops.h>
388 #include <linux/types.h>
9
+#include "../ccm.h"
3910
4011 /* Kernel's enum bpf_reg_type is not uABI so people may change it breaking
4112 * our FW ABI. In that case we will do translation in the driver.
....@@ -52,6 +23,8 @@
5223 NFP_BPF_CAP_TYPE_RANDOM = 4,
5324 NFP_BPF_CAP_TYPE_QUEUE_SELECT = 5,
5425 NFP_BPF_CAP_TYPE_ADJUST_TAIL = 6,
26
+ NFP_BPF_CAP_TYPE_ABI_VERSION = 7,
27
+ NFP_BPF_CAP_TYPE_CMSG_MULTI_ENT = 8,
5528 };
5629
5730 struct nfp_bpf_cap_tlv_func {
....@@ -81,23 +54,8 @@
8154 /*
8255 * Types defined for map related control messages
8356 */
84
-#define CMSG_MAP_ABI_VERSION 1
8557
86
-enum nfp_bpf_cmsg_type {
87
- CMSG_TYPE_MAP_ALLOC = 1,
88
- CMSG_TYPE_MAP_FREE = 2,
89
- CMSG_TYPE_MAP_LOOKUP = 3,
90
- CMSG_TYPE_MAP_UPDATE = 4,
91
- CMSG_TYPE_MAP_DELETE = 5,
92
- CMSG_TYPE_MAP_GETNEXT = 6,
93
- CMSG_TYPE_MAP_GETFIRST = 7,
94
- CMSG_TYPE_BPF_EVENT = 8,
95
- __CMSG_TYPE_MAP_MAX,
96
-};
97
-
98
-#define CMSG_TYPE_MAP_REPLY_BIT 7
99
-#define __CMSG_REPLY(req) (BIT(CMSG_TYPE_MAP_REPLY_BIT) | (req))
100
-
58
+/* BPF ABIv2 fixed-length control message fields */
10159 #define CMSG_MAP_KEY_LW 16
10260 #define CMSG_MAP_VALUE_LW 16
10361
....@@ -112,19 +70,13 @@
11270 CMSG_RC_ERR_MAP_E2BIG = 7,
11371 };
11472
115
-struct cmsg_hdr {
116
- u8 type;
117
- u8 ver;
118
- __be16 tag;
119
-};
120
-
12173 struct cmsg_reply_map_simple {
122
- struct cmsg_hdr hdr;
74
+ struct nfp_ccm_hdr hdr;
12375 __be32 rc;
12476 };
12577
12678 struct cmsg_req_map_alloc_tbl {
127
- struct cmsg_hdr hdr;
79
+ struct nfp_ccm_hdr hdr;
12880 __be32 key_size; /* in bytes */
12981 __be32 value_size; /* in bytes */
13082 __be32 max_entries;
....@@ -138,7 +90,7 @@
13890 };
13991
14092 struct cmsg_req_map_free_tbl {
141
- struct cmsg_hdr hdr;
93
+ struct nfp_ccm_hdr hdr;
14294 __be32 tid;
14395 };
14496
....@@ -147,32 +99,27 @@
14799 __be32 count;
148100 };
149101
150
-struct cmsg_key_value_pair {
151
- __be32 key[CMSG_MAP_KEY_LW];
152
- __be32 value[CMSG_MAP_VALUE_LW];
153
-};
154
-
155102 struct cmsg_req_map_op {
156
- struct cmsg_hdr hdr;
103
+ struct nfp_ccm_hdr hdr;
157104 __be32 tid;
158105 __be32 count;
159106 __be32 flags;
160
- struct cmsg_key_value_pair elem[0];
107
+ u8 data[];
161108 };
162109
163110 struct cmsg_reply_map_op {
164111 struct cmsg_reply_map_simple reply_hdr;
165112 __be32 count;
166113 __be32 resv;
167
- struct cmsg_key_value_pair elem[0];
114
+ u8 data[];
168115 };
169116
170117 struct cmsg_bpf_event {
171
- struct cmsg_hdr hdr;
118
+ struct nfp_ccm_hdr hdr;
172119 __be32 cpu_id;
173120 __be64 map_ptr;
174121 __be32 data_size;
175122 __be32 pkt_size;
176
- u8 data[0];
123
+ u8 data[];
177124 };
178125 #endif