Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : *
3 : : * Copyright (c) 2015-2016 Freescale Semiconductor, Inc. All rights reserved.
4 : : * Copyright 2016-2025 NXP
5 : : *
6 : : */
7 : :
8 : : #ifndef _DPAA2_ETHDEV_H
9 : : #define _DPAA2_ETHDEV_H
10 : :
11 : : #include <rte_compat.h>
12 : : #include <rte_event_eth_rx_adapter.h>
13 : : #include <rte_pmd_dpaa2.h>
14 : :
15 : : #include <bus_fslmc_driver.h>
16 : : #include <dpaa2_hw_pvt.h>
17 : : #include "dpaa2_tm.h"
18 : :
19 : : #include <mc/fsl_dpni.h>
20 : : #include <mc/fsl_mc_sys.h>
21 : : #include <mc/fsl_dpmac.h>
22 : :
23 : : #include "base/dpaa2_hw_dpni_annot.h"
24 : :
25 : : #define DPAA2_MIN_RX_BUF_SIZE 512
26 : : #define DPAA2_MAX_RX_PKT_LEN 10240 /*WRIOP support*/
27 : : #define NET_DPAA2_PMD_DRIVER_NAME net_dpaa2
28 : :
29 : : #define MAX_TCS DPNI_MAX_TC
30 : : #define MAX_RX_QUEUES 128
31 : : #define MAX_TX_QUEUES 16
32 : : #define MAX_DPNI 8
33 : : #define DPAA2_MAX_CHANNELS 16
34 : :
35 : : #define DPAA2_EXTRACT_PARAM_MAX_SIZE \
36 : : RTE_ALIGN(sizeof(struct dpni_ext_set_rx_tc_dist), 256)
37 : :
38 : : #define DPAA2_EXTRACT_ALLOC_KEY_MAX_SIZE 256
39 : :
40 : : #define DPAA2_RX_DEFAULT_NBDESC 512
41 : :
42 : : #define DPAA2_ETH_MAX_LEN (RTE_ETHER_MTU + \
43 : : RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \
44 : : VLAN_TAG_SIZE)
45 : :
46 : : /*default tc to be used for ,congestion, distribution etc configuration. */
47 : : #define DPAA2_DEF_TC 0
48 : :
49 : : /* Threshold for a Tx queue to *Enter* Congestion state.
50 : : */
51 : : #define CONG_ENTER_TX_THRESHOLD 512
52 : :
53 : : /* Threshold for a queue to *Exit* Congestion state.
54 : : */
55 : : #define CONG_EXIT_TX_THRESHOLD 480
56 : :
57 : : #define CONG_RETRY_COUNT 18000
58 : :
59 : : /* RX queue tail drop threshold
60 : : * currently considering 64 KB packets
61 : : */
62 : : #define CONG_THRESHOLD_RX_BYTES_Q (64 * 1024)
63 : : #define CONG_RX_OAL 128
64 : :
65 : : /* Size of the input SMMU mapped memory required by MC */
66 : : #define DIST_PARAM_IOVA_SIZE DPAA2_EXTRACT_PARAM_MAX_SIZE
67 : :
68 : : /* Enable TX Congestion control support
69 : : * default is disable
70 : : */
71 : : #define DPAA2_TX_CGR_OFF RTE_BIT32(0)
72 : :
73 : : /* Drop packets with parsing error in hw */
74 : : #define DPAA2_PARSE_ERR_DROP RTE_BIT32(1)
75 : :
76 : : /* Disable RX tail drop, default is enable */
77 : : #define DPAA2_RX_TAILDROP_OFF RTE_BIT32(2)
78 : :
79 : : /* Disable prefetch Rx mode to get exact requested packets */
80 : : #define DPAA2_NO_PREFETCH_RX RTE_BIT32(3)
81 : :
82 : : /* Driver level loop mode to simply transmit the ingress traffic */
83 : : #define DPAA2_RX_LOOPBACK_MODE RTE_BIT32(4)
84 : :
85 : : /* HW loopback the egress traffic to self ingress*/
86 : : #define DPAA2_TX_MAC_LOOPBACK_MODE RTE_BIT32(5)
87 : :
88 : : #define DPAA2_TX_SERDES_LOOPBACK_MODE RTE_BIT32(6)
89 : :
90 : : #define DPAA2_TX_DPNI_LOOPBACK_MODE RTE_BIT32(7)
91 : :
92 : : /* Tx confirmation enabled */
93 : : #define DPAA2_TX_CONF_ENABLE RTE_BIT32(8)
94 : :
95 : : /* Tx dynamic confirmation enabled,
96 : : * only valid with Tx confirmation enabled.
97 : : */
98 : : #define DPAA2_TX_DYNAMIC_CONF_ENABLE RTE_BIT32(9)
99 : :
100 : : /* Disable data stashing (prefetch of packet data into CPU cache) */
101 : : #define DPAA2_RX_DATA_STASHING_OFF_FLAG RTE_BIT32(10)
102 : :
103 : : #define DPAA2_RX_ERROR_QUEUE_FLAG RTE_BIT32(11)
104 : :
105 : : /* DPDMUX index for DPMAC */
106 : : #define DPAA2_DPDMUX_DPMAC_IDX 0
107 : :
108 : : #define DPAA2_TX_LOOPBACK_MODE \
109 : : (DPAA2_TX_MAC_LOOPBACK_MODE | \
110 : : DPAA2_TX_SERDES_LOOPBACK_MODE | \
111 : : DPAA2_TX_DPNI_LOOPBACK_MODE)
112 : :
113 : : #define DPAA2_RSS_OFFLOAD_ALL ( \
114 : : RTE_ETH_RSS_L2_PAYLOAD | \
115 : : RTE_ETH_RSS_IP | \
116 : : RTE_ETH_RSS_UDP | \
117 : : RTE_ETH_RSS_TCP | \
118 : : RTE_ETH_RSS_SCTP | \
119 : : RTE_ETH_RSS_MPLS | \
120 : : RTE_ETH_RSS_C_VLAN | \
121 : : RTE_ETH_RSS_S_VLAN | \
122 : : RTE_ETH_RSS_ESP | \
123 : : RTE_ETH_RSS_AH | \
124 : : RTE_ETH_RSS_PPPOE)
125 : :
126 : : /* LX2 FRC Parsed values (Little Endian) */
127 : : #define DPAA2_PKT_TYPE_ETHER 0x0060
128 : : #define DPAA2_PKT_TYPE_IPV4 0x0000
129 : : #define DPAA2_PKT_TYPE_IPV6 0x0020
130 : : #define DPAA2_PKT_TYPE_IPV4_FRAG \
131 : : (0x0001 | DPAA2_PKT_TYPE_IPV4)
132 : : #define DPAA2_PKT_TYPE_IPV6_FRAG \
133 : : (0x0001 | DPAA2_PKT_TYPE_IPV6)
134 : : #define DPAA2_PKT_TYPE_IPV4_TCP \
135 : : (0x000e | DPAA2_PKT_TYPE_IPV4)
136 : : #define DPAA2_PKT_TYPE_IPV6_TCP \
137 : : (0x000e | DPAA2_PKT_TYPE_IPV6)
138 : : #define DPAA2_PKT_TYPE_IPV4_UDP \
139 : : (0x0010 | DPAA2_PKT_TYPE_IPV4)
140 : : #define DPAA2_PKT_TYPE_IPV6_UDP \
141 : : (0x0010 | DPAA2_PKT_TYPE_IPV6)
142 : : #define DPAA2_PKT_TYPE_IPV4_SCTP \
143 : : (0x000f | DPAA2_PKT_TYPE_IPV4)
144 : : #define DPAA2_PKT_TYPE_IPV6_SCTP \
145 : : (0x000f | DPAA2_PKT_TYPE_IPV6)
146 : : #define DPAA2_PKT_TYPE_IPV4_ICMP \
147 : : (0x0003 | DPAA2_PKT_TYPE_IPV4_FRAG)
148 : : #define DPAA2_PKT_TYPE_IPV6_ICMP \
149 : : (0x0003 | DPAA2_PKT_TYPE_IPV6_FRAG)
150 : : #define DPAA2_PKT_TYPE_IPV4_ESP \
151 : : (0x0005 | DPAA2_PKT_TYPE_IPV4)
152 : : #define DPAA2_PKT_TYPE_IPV6_ESP \
153 : : (0x0005 | DPAA2_PKT_TYPE_IPV6)
154 : : #define DPAA2_PKT_TYPE_IPV4_GTPU \
155 : : (0x0014 | DPAA2_PKT_TYPE_IPV4)
156 : : #define DPAA2_PKT_TYPE_IPV6_GTPU \
157 : : (0x0014 | DPAA2_PKT_TYPE_IPV6)
158 : : #define DPAA2_PKT_TYPE_IPV4_GTPC \
159 : : (0x0015 | DPAA2_PKT_TYPE_IPV4)
160 : : #define DPAA2_PKT_TYPE_IPV6_GTPC \
161 : : (0x0015 | DPAA2_PKT_TYPE_IPV6)
162 : : #define DPAA2_PKT_TYPE_VLAN_1 0x0160
163 : : #define DPAA2_PKT_TYPE_VLAN_2 0x0260
164 : :
165 : : /* mac counters */
166 : : #define DPAA2_MAC_NUM_STATS (DPMAC_CNT_EGR_CONTROL_FRAME + 1)
167 : : #define DPAA2_MAC_STATS_INDEX_DMA_SIZE (DPAA2_MAC_NUM_STATS * sizeof(uint32_t))
168 : : #define DPAA2_MAC_STATS_VALUE_DMA_SIZE (DPAA2_MAC_NUM_STATS * sizeof(uint64_t))
169 : :
170 : : /* Global pool used by driver for SG list TX */
171 : : extern struct rte_mempool *dpaa2_tx_sg_pool;
172 : : /* Maximum SG segments */
173 : : #define DPAA2_MAX_SGS 128
174 : : /* SG pool size */
175 : : #define DPAA2_POOL_SIZE 2048
176 : : /* SG pool cache size */
177 : : #define DPAA2_POOL_CACHE_SIZE 256
178 : : /* structure to free external and indirect
179 : : * buffers.
180 : : */
181 : : struct sw_buf_free {
182 : : /* To which packet this segment belongs */
183 : : uint16_t pkt_id;
184 : : /* The actual segment */
185 : : struct rte_mbuf *seg;
186 : : };
187 : :
188 : : /* enable timestamp in mbuf*/
189 : : extern bool dpaa2_enable_ts[];
190 : : extern uint64_t dpaa2_timestamp_rx_dynflag;
191 : : extern int dpaa2_timestamp_dynfield_offset;
192 : :
193 : : /* Externally defined */
194 : : extern const struct rte_flow_ops dpaa2_flow_ops;
195 : :
196 : : extern const struct rte_tm_ops dpaa2_tm_ops;
197 : :
198 : : extern bool dpaa2_print_parser_result;
199 : :
200 : : #define DPAA2_FAPR_SIZE \
201 : : (sizeof(struct dpaa2_annot_hdr) - \
202 : : offsetof(struct dpaa2_annot_hdr, word3))
203 : :
204 : : #define DPAA2_PR_NXTHDR_OFFSET 0
205 : :
206 : : #define DPAA2_FAFE_PSR_OFFSET 2
207 : : #define DPAA2_FAFE_PSR_SIZE 2
208 : :
209 : : #define DPAA2_FAF_PSR_OFFSET 4
210 : : #define DPAA2_FAF_PSR_SIZE 12
211 : :
212 : : #define DPAA2_FAF_TOTAL_SIZE \
213 : : (DPAA2_FAFE_PSR_SIZE + DPAA2_FAF_PSR_SIZE)
214 : :
215 : : /* Just most popular Frame attribute flags (FAF) here.*/
216 : : enum dpaa2_rx_faf_offset {
217 : : /* Set by SP start*/
218 : : FAFE_VXLAN_IN_VLAN_FRAM = 0,
219 : : FAFE_VXLAN_IN_IPV4_FRAM = 1,
220 : : FAFE_VXLAN_IN_IPV6_FRAM = 2,
221 : : FAFE_VXLAN_IN_UDP_FRAM = 3,
222 : : FAFE_VXLAN_IN_TCP_FRAM = 4,
223 : :
224 : : FAFE_ECPRI_FRAM = 7,
225 : : /* Set by SP end*/
226 : :
227 : : FAF_GTP_PRIMED_FRAM = 1 + DPAA2_FAFE_PSR_SIZE * 8,
228 : : FAF_PTP_FRAM = 3 + DPAA2_FAFE_PSR_SIZE * 8,
229 : : FAF_VXLAN_FRAM = 4 + DPAA2_FAFE_PSR_SIZE * 8,
230 : : FAF_ETH_FRAM = 10 + DPAA2_FAFE_PSR_SIZE * 8,
231 : : FAF_LLC_SNAP_FRAM = 18 + DPAA2_FAFE_PSR_SIZE * 8,
232 : : FAF_VLAN_FRAM = 21 + DPAA2_FAFE_PSR_SIZE * 8,
233 : : FAF_PPPOE_PPP_FRAM = 25 + DPAA2_FAFE_PSR_SIZE * 8,
234 : : FAF_MPLS_FRAM = 27 + DPAA2_FAFE_PSR_SIZE * 8,
235 : : FAF_ARP_FRAM = 30 + DPAA2_FAFE_PSR_SIZE * 8,
236 : : FAF_IPV4_FRAM = 34 + DPAA2_FAFE_PSR_SIZE * 8,
237 : : FAF_IPV6_FRAM = 42 + DPAA2_FAFE_PSR_SIZE * 8,
238 : : FAF_IP_FRAM = 48 + DPAA2_FAFE_PSR_SIZE * 8,
239 : : FAF_IP_FRAG_FRAM = 50 + DPAA2_FAFE_PSR_SIZE * 8,
240 : : FAF_ICMP_FRAM = 57 + DPAA2_FAFE_PSR_SIZE * 8,
241 : : FAF_IGMP_FRAM = 58 + DPAA2_FAFE_PSR_SIZE * 8,
242 : : FAF_GRE_FRAM = 65 + DPAA2_FAFE_PSR_SIZE * 8,
243 : : FAF_UDP_FRAM = 70 + DPAA2_FAFE_PSR_SIZE * 8,
244 : : FAF_TCP_FRAM = 72 + DPAA2_FAFE_PSR_SIZE * 8,
245 : : FAF_IPSEC_FRAM = 77 + DPAA2_FAFE_PSR_SIZE * 8,
246 : : FAF_IPSEC_ESP_FRAM = 78 + DPAA2_FAFE_PSR_SIZE * 8,
247 : : FAF_IPSEC_AH_FRAM = 79 + DPAA2_FAFE_PSR_SIZE * 8,
248 : : FAF_SCTP_FRAM = 81 + DPAA2_FAFE_PSR_SIZE * 8,
249 : : FAF_DCCP_FRAM = 83 + DPAA2_FAFE_PSR_SIZE * 8,
250 : : FAF_GTP_FRAM = 87 + DPAA2_FAFE_PSR_SIZE * 8,
251 : : FAF_ESP_FRAM = 89 + DPAA2_FAFE_PSR_SIZE * 8,
252 : : };
253 : :
254 : : enum dpaa2_ecpri_fafe_type {
255 : : ECPRI_FAFE_TYPE_0 = (8 - FAFE_ECPRI_FRAM),
256 : : ECPRI_FAFE_TYPE_1 = (8 - FAFE_ECPRI_FRAM) | (1 << 1),
257 : : ECPRI_FAFE_TYPE_2 = (8 - FAFE_ECPRI_FRAM) | (2 << 1),
258 : : ECPRI_FAFE_TYPE_3 = (8 - FAFE_ECPRI_FRAM) | (3 << 1),
259 : : ECPRI_FAFE_TYPE_4 = (8 - FAFE_ECPRI_FRAM) | (4 << 1),
260 : : ECPRI_FAFE_TYPE_5 = (8 - FAFE_ECPRI_FRAM) | (5 << 1),
261 : : ECPRI_FAFE_TYPE_6 = (8 - FAFE_ECPRI_FRAM) | (6 << 1),
262 : : ECPRI_FAFE_TYPE_7 = (8 - FAFE_ECPRI_FRAM) | (7 << 1)
263 : : };
264 : :
265 : : #define DPAA2_PR_ETH_OFF_OFFSET 19
266 : : #define DPAA2_PR_TCI_OFF_OFFSET 21
267 : : #define DPAA2_PR_LAST_ETYPE_OFFSET 23
268 : : #define DPAA2_PR_L3_OFF_OFFSET 27
269 : : #define DPAA2_PR_L4_OFF_OFFSET 30
270 : : #define DPAA2_PR_L5_OFF_OFFSET 31
271 : : #define DPAA2_PR_NXTHDR_OFF_OFFSET 34
272 : :
273 : : /* Set by SP for vxlan distribution start*/
274 : : #define DPAA2_VXLAN_IN_TCI_OFFSET 16
275 : :
276 : : #define DPAA2_VXLAN_IN_DADDR0_OFFSET 20
277 : : #define DPAA2_VXLAN_IN_DADDR1_OFFSET 22
278 : : #define DPAA2_VXLAN_IN_DADDR2_OFFSET 24
279 : : #define DPAA2_VXLAN_IN_DADDR3_OFFSET 25
280 : : #define DPAA2_VXLAN_IN_DADDR4_OFFSET 26
281 : : #define DPAA2_VXLAN_IN_DADDR5_OFFSET 28
282 : :
283 : : #define DPAA2_VXLAN_IN_SADDR0_OFFSET 29
284 : : #define DPAA2_VXLAN_IN_SADDR1_OFFSET 32
285 : : #define DPAA2_VXLAN_IN_SADDR2_OFFSET 33
286 : : #define DPAA2_VXLAN_IN_SADDR3_OFFSET 35
287 : : #define DPAA2_VXLAN_IN_SADDR4_OFFSET 41
288 : : #define DPAA2_VXLAN_IN_SADDR5_OFFSET 42
289 : :
290 : : #define DPAA2_VXLAN_VNI_OFFSET 43
291 : : #define DPAA2_VXLAN_IN_TYPE_OFFSET 46
292 : : /* Set by SP for vxlan distribution end*/
293 : :
294 : : /* ECPRI shares SP context with VXLAN*/
295 : : #define DPAA2_ECPRI_MSG_OFFSET DPAA2_VXLAN_VNI_OFFSET
296 : :
297 : : #define DPAA2_FS_FLC_FS_MARK_OFFSET \
298 : : (DPAA2_FLC_DATA_STASHING + DPAA2_FLC_STASHING_MAX_BIT_SIZE)
299 : :
300 : : #define DPAA2_FS_FLC_TC_OFFSET \
301 : : (DPAA2_FS_FLC_FS_MARK_OFFSET + DPAA2_FLC_STASHING_MAX_BIT_SIZE)
302 : :
303 : : #define DPAA2_FS_FLC_TC_BIT_SIZE (sizeof(uint8_t) * 8)
304 : : #define DPAA2_FS_FLC_TC_MASK ((1 << DPAA2_FS_FLC_TC_BIT_SIZE) - 1)
305 : :
306 : : #define DPAA2_FS_FLC_FLOW_OFFSET \
307 : : (DPAA2_FS_FLC_TC_OFFSET + DPAA2_FS_FLC_TC_BIT_SIZE)
308 : :
309 : : #define DPAA2_ECPRI_MAX_EXTRACT_NB 8
310 : :
311 : : struct ipv4_sd_addr_extract_rule {
312 : : uint32_t ipv4_src;
313 : : uint32_t ipv4_dst;
314 : : };
315 : :
316 : : struct ipv6_sd_addr_extract_rule {
317 : : uint8_t ipv6_src[NH_FLD_IPV6_ADDR_SIZE];
318 : : uint8_t ipv6_dst[NH_FLD_IPV6_ADDR_SIZE];
319 : : };
320 : :
321 : : struct ipv4_ds_addr_extract_rule {
322 : : uint32_t ipv4_dst;
323 : : uint32_t ipv4_src;
324 : : };
325 : :
326 : : struct ipv6_ds_addr_extract_rule {
327 : : uint8_t ipv6_dst[NH_FLD_IPV6_ADDR_SIZE];
328 : : uint8_t ipv6_src[NH_FLD_IPV6_ADDR_SIZE];
329 : : };
330 : :
331 : : union ip_addr_extract_rule {
332 : : struct ipv4_sd_addr_extract_rule ipv4_sd_addr;
333 : : struct ipv6_sd_addr_extract_rule ipv6_sd_addr;
334 : : struct ipv4_ds_addr_extract_rule ipv4_ds_addr;
335 : : struct ipv6_ds_addr_extract_rule ipv6_ds_addr;
336 : : };
337 : :
338 : : union ip_src_addr_extract_rule {
339 : : uint32_t ipv4_src;
340 : : uint8_t ipv6_src[NH_FLD_IPV6_ADDR_SIZE];
341 : : };
342 : :
343 : : union ip_dst_addr_extract_rule {
344 : : uint32_t ipv4_dst;
345 : : uint8_t ipv6_dst[NH_FLD_IPV6_ADDR_SIZE];
346 : : };
347 : :
348 : : enum ip_addr_extract_type {
349 : : IP_NONE_ADDR_EXTRACT,
350 : : IP_SRC_EXTRACT,
351 : : IP_DST_EXTRACT,
352 : : IP_SRC_DST_EXTRACT,
353 : : IP_DST_SRC_EXTRACT
354 : : };
355 : :
356 : : enum key_prot_type {
357 : : /* HW extracts from standard protocol fields*/
358 : : DPAA2_NET_PROT_KEY,
359 : : /* HW extracts from FAF of PR*/
360 : : DPAA2_FAF_KEY,
361 : : /* HW extracts from PR other than FAF*/
362 : : DPAA2_PR_KEY
363 : : };
364 : :
365 : : struct key_prot_field {
366 : : enum key_prot_type type;
367 : : enum net_prot prot;
368 : : uint32_t key_field;
369 : : };
370 : :
371 : : struct dpaa2_raw_region {
372 : : uint8_t raw_start;
373 : : uint8_t raw_size;
374 : : };
375 : :
376 : : struct dpaa2_key_profile {
377 : : uint8_t num;
378 : : uint8_t key_offset[DPKG_MAX_NUM_OF_EXTRACTS];
379 : : uint8_t key_size[DPKG_MAX_NUM_OF_EXTRACTS];
380 : :
381 : : enum ip_addr_extract_type ip_addr_type;
382 : : uint8_t ip_addr_extract_pos;
383 : : uint8_t ip_addr_extract_off;
384 : :
385 : : uint8_t raw_extract_pos;
386 : : uint8_t raw_extract_off;
387 : : uint8_t raw_extract_num;
388 : :
389 : : uint8_t l4_src_port_present;
390 : : uint8_t l4_src_port_pos;
391 : : uint8_t l4_src_port_offset;
392 : : uint8_t l4_dst_port_present;
393 : : uint8_t l4_dst_port_pos;
394 : : uint8_t l4_dst_port_offset;
395 : : struct key_prot_field prot_field[DPKG_MAX_NUM_OF_EXTRACTS];
396 : : uint16_t key_max_size;
397 : : struct dpaa2_raw_region raw_region;
398 : : };
399 : :
400 : : struct dpaa2_key_extract {
401 : : struct dpkg_profile_cfg dpkg;
402 : : struct dpaa2_key_profile key_profile;
403 : : };
404 : :
405 : : struct extract_s {
406 : : struct dpaa2_key_extract qos_key_extract;
407 : : struct dpaa2_key_extract tc_key_extract[MAX_TCS];
408 : : uint8_t *qos_extract_param;
409 : : uint8_t *tc_extract_param[MAX_TCS];
410 : : };
411 : :
412 : : struct dpaa2_dev_priv {
413 : : void *hw;
414 : : int32_t hw_id;
415 : : int32_t qdid;
416 : : uint16_t token;
417 : : uint8_t nb_tx_queues;
418 : : uint8_t nb_rx_queues;
419 : : uint32_t options;
420 : : void *rx_vq[MAX_RX_QUEUES];
421 : : void *tx_vq[MAX_TX_QUEUES];
422 : : struct dpaa2_bp_list *bp_list; /**<Attached buffer pool list */
423 : : void *tx_conf_vq[MAX_TX_QUEUES * DPAA2_MAX_CHANNELS];
424 : : void *rx_err_vq;
425 : : uint32_t flags; /*dpaa2 config flags */
426 : : uint8_t max_mac_filters;
427 : : uint8_t max_vlan_filters;
428 : : uint8_t num_rx_tc;
429 : : uint8_t num_tx_tc;
430 : : uint16_t qos_entries;
431 : : uint16_t fs_entries;
432 : : uint8_t dist_queues;
433 : : uint8_t num_channels;
434 : : uint8_t en_ordered;
435 : : uint8_t en_loose_ordered;
436 : : uint8_t max_cgs;
437 : : uint8_t cgid_in_use[MAX_RX_QUEUES];
438 : :
439 : : /* Current hash distribution size per RX TC, written by
440 : : * dpaa2_setup_flow_dist_size() and read by reta_query / reta_update.
441 : : * Zero means "use default" (= nb_rx_queues clamped to dist_queues).
442 : : */
443 : : uint16_t dist_size_cur[MAX_TCS];
444 : :
445 : : uint16_t dpni_ver_major;
446 : : uint16_t dpni_ver_minor;
447 : : uint32_t speed_capa;
448 : :
449 : : enum rte_dpaa2_dev_type ep_dev_type; /**< Endpoint Device Type */
450 : : uint16_t ep_object_id; /**< Endpoint DPAA2 Object ID */
451 : : char ep_name[RTE_DEV_NAME_MAX_LEN];
452 : :
453 : : struct extract_s extract;
454 : :
455 : : uint16_t ss_offset;
456 : : uint64_t ss_iova;
457 : : uint64_t ss_param_iova;
458 : : /*stores timestamp of last received packet on dev*/
459 : : uint64_t rx_timestamp;
460 : : /*stores timestamp of last received tx confirmation packet on dev*/
461 : : uint64_t tx_timestamp;
462 : : /* stores pointer to next tx_conf queue that should be processed,
463 : : * it corresponds to last packet transmitted
464 : : */
465 : : struct dpaa2_queue *next_tx_conf_queue;
466 : :
467 : : struct rte_eth_dev *eth_dev; /**< Pointer back to holding ethdev */
468 : : rte_spinlock_t lpbk_qp_lock;
469 : :
470 : : uint8_t channel_inuse;
471 : : /* Rx-interrupt mode latched at the first dev_configure */
472 : : uint8_t intr_mode;
473 : : uint8_t intr_mode_set;
474 : : /* Stores correction offset for one step timestamping */
475 : : uint16_t ptp_correction_offset;
476 : : /* for mac counters */
477 : : uint32_t *cnt_idx_dma_mem;
478 : : uint64_t *cnt_values_dma_mem;
479 : : uint64_t cnt_idx_iova, cnt_values_iova;
480 : :
481 : : struct dpaa2_dev_flow *curr;
482 : : LIST_HEAD(, dpaa2_dev_flow) flows;
483 : : LIST_HEAD(nodes, dpaa2_tm_node) nodes;
484 : : LIST_HEAD(shaper_profiles, dpaa2_tm_shaper_profile) shaper_profiles;
485 : : };
486 : :
487 : : #define DPNI_GET_MAC_SUPPORTED_IFS_VER_MAJOR 8
488 : : #define DPNI_GET_MAC_SUPPORTED_IFS_VER_MINOR 6
489 : :
490 : : static inline int dpaa2_dev_cmp_dpni_ver(struct dpaa2_dev_priv *priv,
491 : : uint16_t ver_major, uint16_t ver_minor)
492 : : {
493 [ # # ]: 0 : if (priv->dpni_ver_major == ver_major)
494 : 0 : return priv->dpni_ver_minor - ver_minor;
495 : 0 : return priv->dpni_ver_major - ver_major;
496 : : }
497 : :
498 : : int dpaa2_distset_to_dpkg_profile_cfg(uint64_t req_dist_set,
499 : : struct dpkg_profile_cfg *kg_cfg);
500 : :
501 : : int dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
502 : : uint64_t req_dist_set, int tc_index);
503 : :
504 : : int dpaa2_setup_flow_dist_size(struct rte_eth_dev *eth_dev,
505 : : uint64_t req_dist_set, int tc_index, uint16_t dist_size);
506 : :
507 : : int dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev,
508 : : uint8_t tc_index);
509 : :
510 : : int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv,
511 : : struct fsl_mc_io *dpni, void *blist);
512 : :
513 : : __rte_internal
514 : : int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
515 : : int eth_rx_queue_id,
516 : : struct dpaa2_dpcon_dev *dpcon,
517 : : const struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
518 : :
519 : : __rte_internal
520 : : int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
521 : : int eth_rx_queue_id);
522 : :
523 : : uint16_t dpaa2_dev_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
524 : :
525 : : uint16_t dpaa2_dev_loopback_rx(void *queue, struct rte_mbuf **bufs,
526 : : uint16_t nb_pkts);
527 : :
528 : : uint16_t dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs,
529 : : uint16_t nb_pkts);
530 : : uint16_t dpaa2_dev_prefetch_rx_channel(void *queue, struct rte_mbuf **bufs,
531 : : uint16_t nb_pkts);
532 : : uint16_t dpaa2_dev_rx_channel(void *queue, struct rte_mbuf **bufs,
533 : : uint16_t nb_pkts);
534 : : void dpaa2_dev_process_parallel_event(struct qbman_swp *swp,
535 : : const struct qbman_fd *fd,
536 : : const struct qbman_result *dq,
537 : : struct dpaa2_queue *rxq,
538 : : struct rte_event *ev);
539 : : void dpaa2_dev_process_atomic_event(struct qbman_swp *swp,
540 : : const struct qbman_fd *fd,
541 : : const struct qbman_result *dq,
542 : : struct dpaa2_queue *rxq,
543 : : struct rte_event *ev);
544 : : void dpaa2_dev_process_ordered_event(struct qbman_swp *swp,
545 : : const struct qbman_fd *fd,
546 : : const struct qbman_result *dq,
547 : : struct dpaa2_queue *rxq,
548 : : struct rte_event *ev);
549 : : uint16_t dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
550 : : uint16_t dpaa2_dev_tx_ordered(void *queue, struct rte_mbuf **bufs,
551 : : uint16_t nb_pkts);
552 : : __rte_internal
553 : : uint16_t dpaa2_dev_tx_multi_txq_ordered(void **queue,
554 : : struct rte_mbuf **bufs, uint16_t nb_pkts);
555 : :
556 : : void dpaa2_dev_free_eqresp_buf(uint16_t eqresp_ci, struct dpaa2_queue *dpaa2_q);
557 : : void dpaa2_flow_clean(struct rte_eth_dev *dev);
558 : : uint16_t dpaa2_dev_tx_conf(void *queue) __rte_unused;
559 : :
560 : : int dpaa2_timesync_enable(struct rte_eth_dev *dev);
561 : : int dpaa2_timesync_disable(struct rte_eth_dev *dev);
562 : : int dpaa2_timesync_read_time(struct rte_eth_dev *dev,
563 : : struct timespec *timestamp);
564 : : int dpaa2_timesync_write_time(struct rte_eth_dev *dev,
565 : : const struct timespec *timestamp);
566 : : int dpaa2_timesync_adjust_time(struct rte_eth_dev *dev, int64_t delta);
567 : : int dpaa2_timesync_read_rx_timestamp(struct rte_eth_dev *dev,
568 : : struct timespec *timestamp,
569 : : uint32_t flags __rte_unused);
570 : : int dpaa2_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
571 : : struct timespec *timestamp);
572 : :
573 : : int dpaa2_dev_recycle_config(struct rte_eth_dev *eth_dev);
574 : : int dpaa2_dev_recycle_deconfig(struct rte_eth_dev *eth_dev);
575 : : int dpaa2_soft_parser_loaded(void);
576 : :
577 : : void
578 : : dpaa2_dev_mac_setup_stats(struct rte_eth_dev *dev);
579 : :
580 : : #endif /* _DPAA2_ETHDEV_H */
|