1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright 2013-2016 Freescale Semiconductor, Inc.
4 * Copyright 2017, 2023 NXP
10 #define DPNI_VER_MAJOR 7
11 #define DPNI_VER_MINOR 3
14 #define DPNI_CMDID_OPEN 0x8011
15 #define DPNI_CMDID_CLOSE 0x8001
16 #define DPNI_CMDID_CREATE 0x9011
17 #define DPNI_CMDID_DESTROY 0x9811
18 #define DPNI_CMDID_GET_API_VERSION 0xa011
20 #define DPNI_CMDID_ENABLE 0x0021
21 #define DPNI_CMDID_DISABLE 0x0031
22 #define DPNI_CMDID_GET_ATTR 0x0041
23 #define DPNI_CMDID_RESET 0x0051
25 #define DPNI_CMDID_SET_POOLS 0x2002
26 #define DPNI_CMDID_SET_BUFFER_LAYOUT 0x2651
28 #define DPNI_CMDID_GET_QDID 0x2101
29 #define DPNI_CMDID_GET_TX_DATA_OFFSET 0x2121
30 #define DPNI_CMDID_GET_LINK_STATE 0x2151
31 #define DPNI_CMDID_SET_LINK_CFG 0x21A1
33 #define DPNI_CMDID_ADD_MAC_ADDR 0x2261
35 #define DPNI_CMDID_GET_STATISTICS 0x25D1
36 #define DPNI_CMDID_GET_QUEUE 0x25F1
37 #define DPNI_CMDID_SET_QUEUE 0x2601
38 #define DPNI_CMDID_SET_TX_CONFIRMATION_MODE 0x2661
40 /* Macros for accessing command fields smaller than 1byte */
41 #define DPNI_MASK(field) \
42 GENMASK(DPNI_##field##_SHIFT + DPNI_##field##_SIZE - 1, \
44 #define dpni_set_field(var, field, val) \
45 ((var) |= (((val) << DPNI_##field##_SHIFT) & DPNI_MASK(field)))
46 #define dpni_get_field(var, field) \
47 (((var) & DPNI_MASK(field)) >> DPNI_##field##_SHIFT)
50 struct dpni_cmd_open {
54 struct dpni_cmd_create {
58 u8 mac_filter_entries;
60 u8 vlan_filter_entries;
72 struct dpni_cmd_destroy {
76 #define DPNI_BACKUP_POOL(val, order) (((val) & 0x1) << (order))
78 struct dpni_cmd_pool {
84 struct dpni_cmd_set_pools {
89 struct dpni_cmd_pool pool[8];
90 __le16 buffer_size[8];
93 struct dpni_rsp_get_attr {
98 u8 mac_filter_entries;
100 /* response word 1 */
101 u8 vlan_filter_entries;
107 /* response word 2 */
110 __le16 wriop_version;
114 /* There are 3 separate commands for configuring Rx, Tx and Tx confirmation
115 * buffer layouts, but they all share the same parameters.
116 * If one of the functions changes, below structure needs to be split.
119 #define DPNI_PASS_TS_SHIFT 0
120 #define DPNI_PASS_TS_SIZE 1
121 #define DPNI_PASS_PR_SHIFT 1
122 #define DPNI_PASS_PR_SIZE 1
123 #define DPNI_PASS_FS_SHIFT 2
124 #define DPNI_PASS_FS_SIZE 1
125 #define DPNI_PASS_SWO_SHIFT 3
126 #define DPNI_PASS_SWO_SIZE 1
128 struct dpni_cmd_set_buffer_layout {
133 /* from LSB: pass_timestamp:1, parser_result:1, frame_status:1 */
137 __le16 private_data_size;
143 struct dpni_cmd_get_qdid {
147 struct dpni_rsp_get_qdid {
151 struct dpni_rsp_get_tx_data_offset {
155 struct dpni_cmd_set_link_cfg {
163 #define DPNI_LINK_STATE_SHIFT 0
164 #define DPNI_LINK_STATE_SIZE 1
165 #define DPNI_STATE_VALID_SHIFT 1
166 #define DPNI_STATE_VALID_SIZE 1
168 struct dpni_rsp_get_link_state {
180 struct dpni_cmd_add_mac_addr {
188 struct dpni_cmd_get_queue {
195 #define DPNI_DEST_TYPE_SHIFT 0
196 #define DPNI_DEST_TYPE_SIZE 4
197 #define DPNI_CGID_VALID_SHIFT 5
198 #define DPNI_CGID_VALID_SIZE 1
199 #define DPNI_STASH_CTRL_SHIFT 6
200 #define DPNI_STASH_CTRL_SIZE 1
201 #define DPNI_HOLD_ACTIVE_SHIFT 7
202 #define DPNI_HOLD_ACTIVE_SIZE 1
204 struct dpni_rsp_get_queue {
205 /* response word 0 */
207 /* response word 1 */
211 /* From LSB: dest_type:4, pad:1, cgid_valid:1, flc_stash_ctrl:1, hold_active:1 */
213 /* response word 2 */
215 /* response word 3 */
217 /* response word 4 */
225 struct dpni_cmd_set_queue {
246 struct dpni_tx_confirmation_mode {
250 u8 confirmation_mode;
253 struct dpni_cmd_get_statistics {
258 struct dpni_rsp_get_statistics {
265 * Data Path Network Interface API
266 * Contains initialization APIs and runtime control APIs for DPNI
271 /* General DPNI macros */
273 /* Maximum number of traffic classes */
274 #define DPNI_MAX_TC 8
275 /* Maximum number of buffer pools per DPNI */
276 #define DPNI_MAX_DPBP 8
278 /* All traffic classes considered; see dpni_set_rx_flow() */
279 #define DPNI_ALL_TCS (u8)(-1)
280 /* All flows within traffic class considered; see dpni_set_rx_flow() */
281 #define DPNI_ALL_TC_FLOWS (u16)(-1)
282 /* Generate new flow ID; see dpni_set_tx_flow() */
283 #define DPNI_NEW_FLOW_ID (u16)(-1)
284 /* use for common tx-conf queue; see dpni_set_tx_conf_<x>() */
285 #define DPNI_COMMON_TX_CONF (u16)(-1)
287 int dpni_open(struct fsl_mc_io *mc_io, u32 cmd_flags, int dpni_id, u16 *token);
289 int dpni_close(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
291 /* DPNI configuration options */
294 * Allow different distribution key profiles for different traffic classes;
295 * if not set, a single key profile is assumed
297 #define DPNI_OPT_ALLOW_DIST_KEY_PER_TC 0x00000001
300 * Disable all non-error transmit confirmation; error frames are reported
301 * back to a common Tx error queue
303 #define DPNI_OPT_TX_CONF_DISABLED 0x00000002
305 /* Disable per-sender private Tx confirmation/error queue */
306 #define DPNI_OPT_PRIVATE_TX_CONF_ERROR_DISABLED 0x00000004
309 * Support distribution based on hashed key;
310 * allows statistical distribution over receive queues in a traffic class
312 #define DPNI_OPT_DIST_HASH 0x00000010
315 * Support distribution based on flow steering;
316 * allows explicit control of distribution over receive queues in a traffic
319 #define DPNI_OPT_DIST_FS 0x00000020
321 /* Unicast filtering support */
322 #define DPNI_OPT_UNICAST_FILTER 0x00000080
323 /* Multicast filtering support */
324 #define DPNI_OPT_MULTICAST_FILTER 0x00000100
325 /* VLAN filtering support */
326 #define DPNI_OPT_VLAN_FILTER 0x00000200
327 /* Support IP reassembly on received packets */
328 #define DPNI_OPT_IPR 0x00000800
329 /* Support IP fragmentation on transmitted packets */
330 #define DPNI_OPT_IPF 0x00001000
331 /* VLAN manipulation support */
332 #define DPNI_OPT_VLAN_MANIPULATION 0x00010000
333 /* Support masking of QoS lookup keys */
334 #define DPNI_OPT_QOS_MASK_SUPPORT 0x00020000
335 /* Support masking of Flow Steering lookup keys */
336 #define DPNI_OPT_FS_MASK_SUPPORT 0x00040000
339 * enum dpni_queue_type - Identifies a type of queue targeted by the command
340 * @DPNI_QUEUE_RX: Rx queue
341 * @DPNI_QUEUE_TX: Tx queue
342 * @DPNI_QUEUE_TX_CONFIRM: Tx confirmation queue
343 * @DPNI_QUEUE_RX_ERR: Rx error queue
345 enum dpni_queue_type {
348 DPNI_QUEUE_TX_CONFIRM,
353 * struct dpni_cfg - Structure representing DPNI configuration
354 * @options: Any combination of the following options:
355 * DPNI_OPT_TX_FRM_RELEASE
356 * DPNI_OPT_NO_MAC_FILTER
357 * DPNI_OPT_HAS_POLICING
358 * DPNI_OPT_SHARED_CONGESTION
359 * DPNI_OPT_HAS_KEY_MASKING
361 * DPNI_OPT_SINGLE_SENDER
362 * DPNI_OPT_STASHING_DIS
363 * @fs_entries: Number of entries in the flow steering table.
364 * This table is used to select the ingress queue for
365 * ingress traffic, targeting a GPP core or another.
366 * In addition it can be used to discard traffic that
367 * matches the set rule. It is either an exact match table
368 * or a TCAM table, depending on DPNI_OPT_ HAS_KEY_MASKING
369 * bit in OPTIONS field. This field is ignored if
370 * DPNI_OPT_NO_FS bit is set in OPTIONS field. Otherwise,
371 * value 0 defaults to 64. Maximum supported value is 1024.
372 * Note that the total number of entries is limited on the
373 * SoC to as low as 512 entries if TCAM is used.
374 * @vlan_filter_entries: Number of entries in the VLAN address filtering
375 * table. This is an exact match table used to filter
376 * ingress traffic based on VLAN IDs. Value 0 disables VLAN
377 * filtering. Maximum supported value is 16.
378 * @mac_filter_entries: Number of entries in the MAC address filtering
379 * table. This is an exact match table and allows both
380 * unicast and multicast entries. The primary MAC address
381 * of the network interface is not part of this table,
382 * this contains only entries in addition to it. This
383 * field is ignored if DPNI_OPT_ NO_MAC_FILTER is set in
384 * OPTIONS field. Otherwise, value 0 defaults to 80.
385 * Maximum supported value is 80.
386 * @num_queues: Number of Tx and Rx queues used for traffic
387 * distribution. This is orthogonal to QoS and is only
388 * used to distribute traffic to multiple GPP cores.
389 * This configuration affects the number of Tx queues
390 * (logical FQs, all associated with a single CEETM queue),
391 * Rx queues and Tx confirmation queues, if applicable.
392 * Value 0 defaults to one queue. Maximum supported value
394 * @num_tcs: Number of traffic classes (TCs), reserved for the DPNI.
395 * TCs can have different priority levels for the purpose
396 * of Tx scheduling (see DPNI_SET_TX_PRIORITIES), different
397 * BPs (DPNI_ SET_POOLS), policers. There are dedicated QM
398 * queues for traffic classes (including class queues on
399 * Tx). Value 0 defaults to one TC. Maximum supported value
400 * is 16. There are maximum 16 TCs for Tx and 8 TCs for Rx.
401 * When num_tcs>8 Tx will use this value but Rx will have
402 * only 8 traffic classes.
403 * @num_rx_tcs: if set to other value than zero represents number
404 * of TCs used for Rx. Maximum value is 8. If set to zero the
405 * number of Rx TCs will be initialized with the value provided
406 * in num_tcs parameter.
407 * @qos_entries: Number of entries in the QoS classification table. This
408 * table is used to select the TC for ingress traffic. It
409 * is either an exact match or a TCAM table, depending on
410 * DPNI_OPT_ HAS_KEY_MASKING bit in OPTIONS field. This
411 * field is ignored if the DPNI has a single TC. Otherwise,
412 * a value of 0 defaults to 64. Maximum supported value
414 * @num_channels: Number of egress channels used by this dpni object. If
415 * set to zero the dpni object will use a single CEETM channel.
420 u8 vlan_filter_entries;
421 u8 mac_filter_entries;
433 * dpni_prepare_cfg() - function prepare parameters
434 * @cfg: cfg structure
435 * @cfg_buf: Zeroed 256 bytes of memory before mapping it to DMA
437 * This function has to be called before dpni_create()
439 int dpni_prepare_cfg(const struct dpni_cfg *cfg,
442 int dpni_create(struct fsl_mc_io *mc_io, u16 dprc_token, u32 cmd_flags,
443 const struct dpni_cfg *cfg, u32 *obj_id);
445 int dpni_destroy(struct fsl_mc_io *mc_io, u16 dprc_token, u32 cmd_flags,
449 * struct dpni_pools_cfg - Structure representing buffer pools configuration
450 * @num_dpbp: Number of DPBPs
451 * @pool_options: Buffer assignment options
452 * This field is a combination of DPNI_POOL_ASSOC_flags
453 * @pools: Array of buffer pools parameters; The number of valid entries
454 * must match 'num_dpbp' value
455 * @pools.dpbp_id: DPBP object ID
456 * @pools.priority: Priority mask that indicates TC's used with this buffer.
457 * I set to 0x00 MC will assume value 0xff.
458 * @pools.buffer_size: Buffer size
459 * @pools.backup_pool: Backup pool
462 #define DPNI_POOL_ASSOC_QPRI 0
463 #define DPNI_POOL_ASSOC_QDBIN 1
465 struct dpni_pools_cfg {
473 } pools[DPNI_MAX_DPBP];
476 int dpni_set_pools(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
477 const struct dpni_pools_cfg *cfg);
479 int dpni_enable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
481 int dpni_disable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
483 int dpni_reset(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
486 * struct dpni_attr - Structure representing DPNI attributes
487 * @options: Any combination of the following options:
488 * DPNI_OPT_TX_FRM_RELEASE
489 * DPNI_OPT_NO_MAC_FILTER
490 * DPNI_OPT_HAS_POLICING
491 * DPNI_OPT_SHARED_CONGESTION
492 * DPNI_OPT_HAS_KEY_MASKING
494 * DPNI_OPT_STASHING_DIS
495 * @num_queues: Number of Tx and Rx queues used for traffic distribution.
496 * @num_rx_tcs: Number of RX traffic classes (TCs), reserved for the DPNI.
497 * @num_tx_tcs: Number of TX traffic classes (TCs), reserved for the DPNI.
498 * @mac_filter_entries: Number of entries in the MAC address filtering
500 * @vlan_filter_entries: Number of entries in the VLAN address filtering
502 * @qos_entries: Number of entries in the QoS classification table.
503 * @fs_entries: Number of entries in the flow steering table.
504 * @qos_key_size: Size, in bytes, of the QoS look-up key. Defining a key larger
505 * than this when adding QoS entries will result
507 * @fs_key_size: Size, in bytes, of the flow steering look-up key. Defining a
508 * key larger than this when composing the hash + FS key
509 * will result in an error.
510 * @wriop_version: Version of WRIOP HW block.
511 * The 3 version values are stored on 6, 5, 5 bits
514 * - 0x400 - WRIOP version 1.0.0, used on LS2080 and
516 * - 0x421 - WRIOP version 1.1.1, used on LS2088 and
518 * - 0x422 - WRIOP version 1.1.2, used on LS1088 and
520 * - 0xC00 - WRIOP version 3.0.0, used on LX2160 and
528 u8 mac_filter_entries;
529 u8 vlan_filter_entries;
540 int dpni_get_attributes(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
541 struct dpni_attr *attr);
543 /* DPNI buffer layout modification options */
545 /* Select to modify the time-stamp setting */
546 #define DPNI_BUF_LAYOUT_OPT_TIMESTAMP 0x00000001
547 /* Select to modify the parser-result setting; not applicable for Tx */
548 #define DPNI_BUF_LAYOUT_OPT_PARSER_RESULT 0x00000002
549 /* Select to modify the frame-status setting */
550 #define DPNI_BUF_LAYOUT_OPT_FRAME_STATUS 0x00000004
551 /* Select to modify the private-data-size setting */
552 #define DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE 0x00000008
553 /* Select to modify the data-alignment setting */
554 #define DPNI_BUF_LAYOUT_OPT_DATA_ALIGN 0x00000010
555 /* Select to modify the data-head-room setting */
556 #define DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM 0x00000020
557 /*!< Select to modify the data-tail-room setting */
558 #define DPNI_BUF_LAYOUT_OPT_DATA_TAIL_ROOM 0x00000040
559 /* Select to modify the sw-opaque value setting */
560 #define DPNI_BUF_LAYOUT_OPT_SW_OPAQUE 0x00000080
561 /* Select to disable Scatter Gather and use single buffer */
562 #define DPNI_BUF_LAYOUT_OPT_NO_SG 0x00000100
565 * struct dpni_buffer_layout - Structure representing DPNI buffer layout
566 * @options: Flags representing the suggested modifications to the
568 * Use any combination of 'DPNI_BUF_LAYOUT_OPT_<X>' flags
569 * @pass_timestamp: Pass timestamp value
570 * @pass_parser_result: Pass parser results
571 * @pass_frame_status: Pass frame status
572 * @private_data_size: Size kept for private data (in bytes)
573 * @data_align: Data alignment
574 * @data_head_room: Data head room
575 * @data_tail_room: Data tail room
577 struct dpni_buffer_layout {
580 int pass_parser_result;
581 int pass_frame_status;
583 u16 private_data_size;
589 int dpni_set_buffer_layout(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
590 enum dpni_queue_type qtype,
591 const struct dpni_buffer_layout *layout);
593 int dpni_get_qdid(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
594 enum dpni_queue_type qtype, u16 *qdid);
596 int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
599 /* Enable auto-negotiation */
600 #define DPNI_LINK_OPT_AUTONEG 0x0000000000000001ULL
601 /* Enable half-duplex mode */
602 #define DPNI_LINK_OPT_HALF_DUPLEX 0x0000000000000002ULL
603 /* Enable pause frames */
604 #define DPNI_LINK_OPT_PAUSE 0x0000000000000004ULL
605 /* Enable a-symmetric pause frames */
606 #define DPNI_LINK_OPT_ASYM_PAUSE 0x0000000000000008ULL
609 * struct - Structure representing DPNI link configuration
611 * @options: Mask of available options; use 'DPNI_LINK_OPT_<X>' values
612 * @advertising: Speeds that are advertised for autoneg (bitmap)
614 struct dpni_link_cfg {
620 int dpni_set_link_cfg(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
621 const struct dpni_link_cfg *cfg);
624 * struct dpni_link_state - Structure representing DPNI link state
626 * @options: Mask of available options; use 'DPNI_LINK_OPT_<X>' values
627 * @up: Link state; '0' for down, '1' for up
628 * @state_valid: Ignore/Update the state of the link
629 * @supported: Speeds capability of the phy (bitmap)
630 * @advertising: Speeds that are advertised for autoneg (bitmap)
632 struct dpni_link_state {
641 int dpni_get_link_state(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
642 struct dpni_link_state *state);
644 int dpni_add_mac_addr(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
645 const u8 mac_addr[6], u8 flags,
646 u8 tc_id, u8 flow_id);
648 int dpni_get_api_version(struct fsl_mc_io *mc_io, u32 cmd_flags,
649 u16 *major_ver, u16 *minor_ver);
652 * enum dpni_dest - DPNI destination types
653 * @DPNI_DEST_NONE: Unassigned destination; The queue is set in parked mode and
654 * does not generate FQDAN notifications; user is expected to
655 * dequeue from the queue based on polling or other user-defined
657 * @DPNI_DEST_DPIO: The queue is set in schedule mode and generates FQDAN
658 * notifications to the specified DPIO; user is expected to dequeue
659 * from the queue only after notification is received
660 * @DPNI_DEST_DPCON: The queue is set in schedule mode and does not generate
661 * FQDAN notifications, but is connected to the specified DPCON
662 * object; user is expected to dequeue from the DPCON channel
670 /* DPNI Tx flow modification options */
672 /* Select to modify the settings for dedicate Tx confirmation/error */
673 #define DPNI_TX_FLOW_OPT_TX_CONF_ERROR 0x00000001
674 /*!< Select to modify the L3 checksum generation setting */
675 #define DPNI_TX_FLOW_OPT_L3_CHKSUM_GEN 0x00000010
676 /*!< Select to modify the L4 checksum generation setting */
677 #define DPNI_TX_FLOW_OPT_L4_CHKSUM_GEN 0x00000020
680 * enum dpni_confirmation_mode - Defines DPNI options supported for Tx
682 * @DPNI_CONF_AFFINE: For each Tx queue set associated with a sender there is
683 * an affine Tx Confirmation queue
684 * @DPNI_CONF_SINGLE: All Tx queues are associated with a single Tx
686 * @DPNI_CONF_DISABLE: Tx frames are not confirmed. This must be associated
687 * with proper FD set-up to have buffers release to a Buffer Pool, otherwise
688 * buffers will be leaked
690 enum dpni_confirmation_mode {
697 * stashes the whole annotation area (up to 192 bytes)
699 #define DPNI_FLC_STASH_FRAME_ANNOTATION 0x00000001
702 * struct dpni_queue - Queue structure
703 * @destination - Destination structure
704 * @destination.id: ID of the destination, only relevant if DEST_TYPE is > 0.
705 * Identifies either a DPIO or a DPCON object.
706 * Not relevant for Tx queues.
707 * @destination.type: May be one of the following:
708 * 0 - No destination, queue can be manually
709 * queried, but will not push traffic or
710 * notifications to a DPIO;
711 * 1 - The destination is a DPIO. When traffic
712 * becomes available in the queue a FQDAN
713 * (FQ data available notification) will be
714 * generated to selected DPIO;
715 * 2 - The destination is a DPCON. The queue is
716 * associated with a DPCON object for the
717 * purpose of scheduling between multiple
718 * queues. The DPCON may be independently
719 * configured to generate notifications.
720 * Not relevant for Tx queues.
721 * @destination.hold_active: Hold active, maintains a queue scheduled for longer
722 * in a DPIO during dequeue to reduce spread of traffic.
723 * Only relevant if queues are
724 * not affined to a single DPIO.
725 * @user_context: User data, presented to the user along with any frames
726 * from this queue. Not relevant for Tx queues.
727 * @flc: FD FLow Context structure
728 * @flc.value: Default FLC value for traffic dequeued from
729 * this queue. Please check description of FD
730 * structure for more information.
731 * Note that FLC values set using dpni_add_fs_entry,
732 * if any, take precedence over values per queue.
733 * @flc.stash_control: Boolean, indicates whether the 6 lowest
734 * - significant bits are used for stash control.
735 * significant bits are used for stash control. If set, the 6
736 * least significant bits in value are interpreted as follows:
737 * - bits 0-1: indicates the number of 64 byte units of context
738 * that are stashed. FLC value is interpreted as a memory address
739 * in this case, excluding the 6 LS bits.
740 * - bits 2-3: indicates the number of 64 byte units of frame
741 * annotation to be stashed. Annotation is placed at FD[ADDR].
742 * - bits 4-5: indicates the number of 64 byte units of frame
743 * data to be stashed. Frame data is placed at FD[ADDR] +
745 * For more details check the Frame Descriptor section in the
746 * hardware documentation.
747 *@cgid :indicate the cgid to set relative to dpni
765 * struct dpni_queue_id - Queue identification, used for enqueue commands
767 * @fqid: FQID used for enqueueing to and/or configuration of this
769 * @qdbin: Queueing bin, used to enqueue using QDID, DQBIN, QPRI.
770 * Only relevant for Tx queues.
772 struct dpni_queue_id {
777 int dpni_set_queue(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
778 enum dpni_queue_type qtype, u16 param, u8 index,
779 u8 options, const struct dpni_queue *queue);
781 int dpni_get_queue(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
782 enum dpni_queue_type qtype, u16 param, u8 index,
783 struct dpni_queue *queue, struct dpni_queue_id *qid);
785 int dpni_set_tx_confirmation_mode(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
786 u8 ceetm_ch_idx, enum dpni_confirmation_mode mode);
788 #define DPNI_STATISTICS_CNT 7
791 * union dpni_statistics - Union describing the DPNI statistics
792 * @page_0: Page_0 statistics structure
793 * @page_0.ingress_all_frames: Ingress frame count
794 * @page_0.ingress_all_bytes: Ingress byte count
795 * @page_0.ingress_multicast_frames: Ingress multicast frame count
796 * @page_0.ingress_multicast_bytes: Ingress multicast byte count
797 * @page_0.ingress_broadcast_frames: Ingress broadcast frame count
798 * @page_0.ingress_broadcast_bytes: Ingress broadcast byte count
799 * @page_1: Page_1 statistics structure
800 * @page_1.egress_all_frames: Egress frame count
801 * @page_1.egress_all_bytes: Egress byte count
802 * @page_1.egress_multicast_frames: Egress multicast frame count
803 * @page_1.egress_multicast_bytes: Egress multicast byte count
804 * @page_1.egress_broadcast_frames: Egress broadcast frame count
805 * @page_1.egress_broadcast_bytes: Egress broadcast byte count
806 * @page_2: Page_2 statistics structure
807 * @page_2.ingress_filtered_frames: Ingress filtered frame count
808 * @page_2.ingress_discarded_frames: Ingress discarded frame count
809 * @page_2.ingress_nobuffer_discards: Ingress discarded frame count due to
811 * @page_2.egress_discarded_frames: Egress discarded frame count
812 * @page_2.egress_confirmed_frames: Egress confirmed frame count
813 * @page_3: Page_3 statistics structure
814 * @page_3.egress_dequeue_bytes: Cumulative count of the number of bytes
815 * dequeued from egress FQs
816 * @page_3.egress_dequeue_frames: Cumulative count of the number of frames
817 * dequeued from egress FQs
818 * @page_3.egress_reject_bytes: Cumulative count of the number of bytes in
819 * egress frames whose enqueue was rejected
820 * @page_3.egress_reject_frames: Cumulative count of the number of egress
821 * frames whose enqueue was rejected
822 * @page_4: Page_4 statistics structure: congestion points
823 * @page_4.cgr_reject_frames: number of rejected frames due to congestion point
824 * @page_4.cgr_reject_bytes: number of rejected bytes due to congestion point
825 * @page_5: Page_5 statistics structure: policer
826 * @page_5.policer_cnt_red: NUmber of red colored frames
827 * @page_5.policer_cnt_yellow: number of yellow colored frames
828 * @page_5.policer_cnt_green: number of green colored frames
829 * @page_5.policer_cnt_re_red: number of recolored red frames
830 * @page_5.policer_cnt_re_yellow: number of recolored yellow frames
831 * @page_6: Page_6 statistics structure
832 * @page_6.tx_pending_frames: total number of frames pending in egress FQs
833 * @raw: raw statistics structure, used to index counters
835 union dpni_statistics {
837 u64 ingress_all_frames;
838 u64 ingress_all_bytes;
839 u64 ingress_multicast_frames;
840 u64 ingress_multicast_bytes;
841 u64 ingress_broadcast_frames;
842 u64 ingress_broadcast_bytes;
845 u64 egress_all_frames;
846 u64 egress_all_bytes;
847 u64 egress_multicast_frames;
848 u64 egress_multicast_bytes;
849 u64 egress_broadcast_frames;
850 u64 egress_broadcast_bytes;
853 u64 ingress_filtered_frames;
854 u64 ingress_discarded_frames;
855 u64 ingress_nobuffer_discards;
856 u64 egress_discarded_frames;
857 u64 egress_confirmed_frames;
860 u64 egress_dequeue_bytes;
861 u64 egress_dequeue_frames;
862 u64 egress_reject_bytes;
863 u64 egress_reject_frames;
866 u64 cgr_reject_frames;
867 u64 cgr_reject_bytes;
871 u64 policer_cnt_yellow;
872 u64 policer_cnt_green;
873 u64 policer_cnt_re_red;
874 u64 policer_cnt_re_yellow;
877 u64 tx_pending_frames;
880 u64 counter[DPNI_STATISTICS_CNT];
884 int dpni_get_statistics(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
885 u8 page, u16 param, union dpni_statistics *stat);
886 #endif /* _FSL_DPNI_H */