162306a36Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ 262306a36Sopenharmony_ci/* Copyright 2013-2016 Freescale Semiconductor Inc. 362306a36Sopenharmony_ci * Copyright 2016 NXP 462306a36Sopenharmony_ci * Copyright 2020 NXP 562306a36Sopenharmony_ci */ 662306a36Sopenharmony_ci#ifndef __FSL_DPNI_H 762306a36Sopenharmony_ci#define __FSL_DPNI_H 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#include "dpkg.h" 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_cistruct fsl_mc_io; 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci/* Data Path Network Interface API 1462306a36Sopenharmony_ci * Contains initialization APIs and runtime control APIs for DPNI 1562306a36Sopenharmony_ci */ 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci/** General DPNI macros */ 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci/** 2062306a36Sopenharmony_ci * DPNI_MAX_TC - Maximum number of traffic classes 2162306a36Sopenharmony_ci */ 2262306a36Sopenharmony_ci#define DPNI_MAX_TC 8 2362306a36Sopenharmony_ci/** 2462306a36Sopenharmony_ci * DPNI_MAX_DPBP - Maximum number of buffer pools per DPNI 2562306a36Sopenharmony_ci */ 2662306a36Sopenharmony_ci#define DPNI_MAX_DPBP 8 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci/** 2962306a36Sopenharmony_ci * DPNI_ALL_TCS - All traffic classes considered; see dpni_set_queue() 3062306a36Sopenharmony_ci */ 3162306a36Sopenharmony_ci#define DPNI_ALL_TCS (u8)(-1) 3262306a36Sopenharmony_ci/** 3362306a36Sopenharmony_ci * DPNI_ALL_TC_FLOWS - All flows within traffic class considered; see 3462306a36Sopenharmony_ci * dpni_set_queue() 3562306a36Sopenharmony_ci */ 3662306a36Sopenharmony_ci#define DPNI_ALL_TC_FLOWS (u16)(-1) 3762306a36Sopenharmony_ci/** 3862306a36Sopenharmony_ci * DPNI_NEW_FLOW_ID - Generate new flow ID; see dpni_set_queue() 3962306a36Sopenharmony_ci */ 4062306a36Sopenharmony_ci#define DPNI_NEW_FLOW_ID (u16)(-1) 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci/** 4362306a36Sopenharmony_ci * DPNI_OPT_TX_FRM_RELEASE - Tx traffic is always released to a buffer pool on 4462306a36Sopenharmony_ci * transmit, there are no resources allocated to have the frames confirmed back 4562306a36Sopenharmony_ci * to the source after transmission. 4662306a36Sopenharmony_ci */ 4762306a36Sopenharmony_ci#define DPNI_OPT_TX_FRM_RELEASE 0x000001 4862306a36Sopenharmony_ci/** 4962306a36Sopenharmony_ci * DPNI_OPT_NO_MAC_FILTER - Disables support for MAC address filtering for 5062306a36Sopenharmony_ci * addresses other than primary MAC address. This affects both unicast and 5162306a36Sopenharmony_ci * multicast. Promiscuous mode can still be enabled/disabled for both unicast 5262306a36Sopenharmony_ci * and multicast. If promiscuous mode is disabled, only traffic matching the 5362306a36Sopenharmony_ci * primary MAC address will be accepted. 5462306a36Sopenharmony_ci */ 5562306a36Sopenharmony_ci#define DPNI_OPT_NO_MAC_FILTER 0x000002 5662306a36Sopenharmony_ci/** 5762306a36Sopenharmony_ci * DPNI_OPT_HAS_POLICING - Allocate policers for this DPNI. They can be used to 5862306a36Sopenharmony_ci * rate-limit traffic per traffic class (TC) basis. 5962306a36Sopenharmony_ci */ 6062306a36Sopenharmony_ci#define DPNI_OPT_HAS_POLICING 0x000004 6162306a36Sopenharmony_ci/** 6262306a36Sopenharmony_ci * DPNI_OPT_SHARED_CONGESTION - Congestion can be managed in several ways, 6362306a36Sopenharmony_ci * allowing the buffer pool to deplete on ingress, taildrop on each queue or 6462306a36Sopenharmony_ci * use congestion groups for sets of queues. If set, it configures a single 6562306a36Sopenharmony_ci * congestion groups across all TCs. If reset, a congestion group is allocated 6662306a36Sopenharmony_ci * for each TC. Only relevant if the DPNI has multiple traffic classes. 6762306a36Sopenharmony_ci */ 6862306a36Sopenharmony_ci#define DPNI_OPT_SHARED_CONGESTION 0x000008 6962306a36Sopenharmony_ci/** 7062306a36Sopenharmony_ci * DPNI_OPT_HAS_KEY_MASKING - Enables TCAM for Flow Steering and QoS look-ups. 7162306a36Sopenharmony_ci * If not specified, all look-ups are exact match. Note that TCAM is not 7262306a36Sopenharmony_ci * available on LS1088 and its variants. Setting this bit on these SoCs will 7362306a36Sopenharmony_ci * trigger an error. 7462306a36Sopenharmony_ci */ 7562306a36Sopenharmony_ci#define DPNI_OPT_HAS_KEY_MASKING 0x000010 7662306a36Sopenharmony_ci/** 7762306a36Sopenharmony_ci * DPNI_OPT_NO_FS - Disables the flow steering table. 7862306a36Sopenharmony_ci */ 7962306a36Sopenharmony_ci#define DPNI_OPT_NO_FS 0x000020 8062306a36Sopenharmony_ci/** 8162306a36Sopenharmony_ci * DPNI_OPT_SHARED_FS - Flow steering table is shared between all traffic 8262306a36Sopenharmony_ci * classes 8362306a36Sopenharmony_ci */ 8462306a36Sopenharmony_ci#define DPNI_OPT_SHARED_FS 0x001000 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ciint dpni_open(struct fsl_mc_io *mc_io, 8762306a36Sopenharmony_ci u32 cmd_flags, 8862306a36Sopenharmony_ci int dpni_id, 8962306a36Sopenharmony_ci u16 *token); 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ciint dpni_close(struct fsl_mc_io *mc_io, 9262306a36Sopenharmony_ci u32 cmd_flags, 9362306a36Sopenharmony_ci u16 token); 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_ci#define DPNI_POOL_ASSOC_QPRI 0 9662306a36Sopenharmony_ci#define DPNI_POOL_ASSOC_QDBIN 1 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci/** 9962306a36Sopenharmony_ci * struct dpni_pools_cfg - Structure representing buffer pools configuration 10062306a36Sopenharmony_ci * @num_dpbp: Number of DPBPs 10162306a36Sopenharmony_ci * @pool_options: Buffer assignment options. 10262306a36Sopenharmony_ci * This field is a combination of DPNI_POOL_ASSOC_flags 10362306a36Sopenharmony_ci * @pools: Array of buffer pools parameters; The number of valid entries 10462306a36Sopenharmony_ci * must match 'num_dpbp' value 10562306a36Sopenharmony_ci * @pools.dpbp_id: DPBP object ID 10662306a36Sopenharmony_ci * @pools.priority: Priority mask that indicates TC's used with this buffer. 10762306a36Sopenharmony_ci * If set to 0x00 MC will assume value 0xff. 10862306a36Sopenharmony_ci * @pools.buffer_size: Buffer size 10962306a36Sopenharmony_ci * @pools.backup_pool: Backup pool 11062306a36Sopenharmony_ci */ 11162306a36Sopenharmony_cistruct dpni_pools_cfg { 11262306a36Sopenharmony_ci u8 num_dpbp; 11362306a36Sopenharmony_ci u8 pool_options; 11462306a36Sopenharmony_ci struct { 11562306a36Sopenharmony_ci int dpbp_id; 11662306a36Sopenharmony_ci u8 priority_mask; 11762306a36Sopenharmony_ci u16 buffer_size; 11862306a36Sopenharmony_ci int backup_pool; 11962306a36Sopenharmony_ci } pools[DPNI_MAX_DPBP]; 12062306a36Sopenharmony_ci}; 12162306a36Sopenharmony_ci 12262306a36Sopenharmony_ciint dpni_set_pools(struct fsl_mc_io *mc_io, 12362306a36Sopenharmony_ci u32 cmd_flags, 12462306a36Sopenharmony_ci u16 token, 12562306a36Sopenharmony_ci const struct dpni_pools_cfg *cfg); 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ciint dpni_enable(struct fsl_mc_io *mc_io, 12862306a36Sopenharmony_ci u32 cmd_flags, 12962306a36Sopenharmony_ci u16 token); 13062306a36Sopenharmony_ci 13162306a36Sopenharmony_ciint dpni_disable(struct fsl_mc_io *mc_io, 13262306a36Sopenharmony_ci u32 cmd_flags, 13362306a36Sopenharmony_ci u16 token); 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ciint dpni_is_enabled(struct fsl_mc_io *mc_io, 13662306a36Sopenharmony_ci u32 cmd_flags, 13762306a36Sopenharmony_ci u16 token, 13862306a36Sopenharmony_ci int *en); 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ciint dpni_reset(struct fsl_mc_io *mc_io, 14162306a36Sopenharmony_ci u32 cmd_flags, 14262306a36Sopenharmony_ci u16 token); 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_ci/* DPNI IRQ Index and Events */ 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci#define DPNI_IRQ_INDEX 0 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ci/* DPNI_IRQ_EVENT_LINK_CHANGED - indicates a change in link state */ 14962306a36Sopenharmony_ci#define DPNI_IRQ_EVENT_LINK_CHANGED 0x00000001 15062306a36Sopenharmony_ci 15162306a36Sopenharmony_ci/* DPNI_IRQ_EVENT_ENDPOINT_CHANGED - indicates a change in endpoint */ 15262306a36Sopenharmony_ci#define DPNI_IRQ_EVENT_ENDPOINT_CHANGED 0x00000002 15362306a36Sopenharmony_ci 15462306a36Sopenharmony_ciint dpni_set_irq_enable(struct fsl_mc_io *mc_io, 15562306a36Sopenharmony_ci u32 cmd_flags, 15662306a36Sopenharmony_ci u16 token, 15762306a36Sopenharmony_ci u8 irq_index, 15862306a36Sopenharmony_ci u8 en); 15962306a36Sopenharmony_ci 16062306a36Sopenharmony_ciint dpni_get_irq_enable(struct fsl_mc_io *mc_io, 16162306a36Sopenharmony_ci u32 cmd_flags, 16262306a36Sopenharmony_ci u16 token, 16362306a36Sopenharmony_ci u8 irq_index, 16462306a36Sopenharmony_ci u8 *en); 16562306a36Sopenharmony_ci 16662306a36Sopenharmony_ciint dpni_set_irq_mask(struct fsl_mc_io *mc_io, 16762306a36Sopenharmony_ci u32 cmd_flags, 16862306a36Sopenharmony_ci u16 token, 16962306a36Sopenharmony_ci u8 irq_index, 17062306a36Sopenharmony_ci u32 mask); 17162306a36Sopenharmony_ci 17262306a36Sopenharmony_ciint dpni_get_irq_mask(struct fsl_mc_io *mc_io, 17362306a36Sopenharmony_ci u32 cmd_flags, 17462306a36Sopenharmony_ci u16 token, 17562306a36Sopenharmony_ci u8 irq_index, 17662306a36Sopenharmony_ci u32 *mask); 17762306a36Sopenharmony_ci 17862306a36Sopenharmony_ciint dpni_get_irq_status(struct fsl_mc_io *mc_io, 17962306a36Sopenharmony_ci u32 cmd_flags, 18062306a36Sopenharmony_ci u16 token, 18162306a36Sopenharmony_ci u8 irq_index, 18262306a36Sopenharmony_ci u32 *status); 18362306a36Sopenharmony_ci 18462306a36Sopenharmony_ciint dpni_clear_irq_status(struct fsl_mc_io *mc_io, 18562306a36Sopenharmony_ci u32 cmd_flags, 18662306a36Sopenharmony_ci u16 token, 18762306a36Sopenharmony_ci u8 irq_index, 18862306a36Sopenharmony_ci u32 status); 18962306a36Sopenharmony_ci 19062306a36Sopenharmony_ci/** 19162306a36Sopenharmony_ci * struct dpni_attr - Structure representing DPNI attributes 19262306a36Sopenharmony_ci * @options: Any combination of the following options: 19362306a36Sopenharmony_ci * DPNI_OPT_TX_FRM_RELEASE 19462306a36Sopenharmony_ci * DPNI_OPT_NO_MAC_FILTER 19562306a36Sopenharmony_ci * DPNI_OPT_HAS_POLICING 19662306a36Sopenharmony_ci * DPNI_OPT_SHARED_CONGESTION 19762306a36Sopenharmony_ci * DPNI_OPT_HAS_KEY_MASKING 19862306a36Sopenharmony_ci * DPNI_OPT_NO_FS 19962306a36Sopenharmony_ci * @num_queues: Number of Tx and Rx queues used for traffic distribution. 20062306a36Sopenharmony_ci * @num_tcs: Number of traffic classes (TCs), reserved for the DPNI. 20162306a36Sopenharmony_ci * @mac_filter_entries: Number of entries in the MAC address filtering table. 20262306a36Sopenharmony_ci * @vlan_filter_entries: Number of entries in the VLAN address filtering table. 20362306a36Sopenharmony_ci * @qos_entries: Number of entries in the QoS classification table. 20462306a36Sopenharmony_ci * @fs_entries: Number of entries in the flow steering table. 20562306a36Sopenharmony_ci * @qos_key_size: Size, in bytes, of the QoS look-up key. Defining a key larger 20662306a36Sopenharmony_ci * than this when adding QoS entries will result in an error. 20762306a36Sopenharmony_ci * @fs_key_size: Size, in bytes, of the flow steering look-up key. Defining a 20862306a36Sopenharmony_ci * key larger than this when composing the hash + FS key will 20962306a36Sopenharmony_ci * result in an error. 21062306a36Sopenharmony_ci * @wriop_version: Version of WRIOP HW block. The 3 version values are stored 21162306a36Sopenharmony_ci * on 6, 5, 5 bits respectively. 21262306a36Sopenharmony_ci */ 21362306a36Sopenharmony_cistruct dpni_attr { 21462306a36Sopenharmony_ci u32 options; 21562306a36Sopenharmony_ci u8 num_queues; 21662306a36Sopenharmony_ci u8 num_tcs; 21762306a36Sopenharmony_ci u8 mac_filter_entries; 21862306a36Sopenharmony_ci u8 vlan_filter_entries; 21962306a36Sopenharmony_ci u8 qos_entries; 22062306a36Sopenharmony_ci u16 fs_entries; 22162306a36Sopenharmony_ci u8 qos_key_size; 22262306a36Sopenharmony_ci u8 fs_key_size; 22362306a36Sopenharmony_ci u16 wriop_version; 22462306a36Sopenharmony_ci}; 22562306a36Sopenharmony_ci 22662306a36Sopenharmony_ciint dpni_get_attributes(struct fsl_mc_io *mc_io, 22762306a36Sopenharmony_ci u32 cmd_flags, 22862306a36Sopenharmony_ci u16 token, 22962306a36Sopenharmony_ci struct dpni_attr *attr); 23062306a36Sopenharmony_ci 23162306a36Sopenharmony_ci/* DPNI errors */ 23262306a36Sopenharmony_ci 23362306a36Sopenharmony_ci/** 23462306a36Sopenharmony_ci * DPNI_ERROR_EOFHE - Extract out of frame header error 23562306a36Sopenharmony_ci */ 23662306a36Sopenharmony_ci#define DPNI_ERROR_EOFHE 0x00020000 23762306a36Sopenharmony_ci/** 23862306a36Sopenharmony_ci * DPNI_ERROR_FLE - Frame length error 23962306a36Sopenharmony_ci */ 24062306a36Sopenharmony_ci#define DPNI_ERROR_FLE 0x00002000 24162306a36Sopenharmony_ci/** 24262306a36Sopenharmony_ci * DPNI_ERROR_FPE - Frame physical error 24362306a36Sopenharmony_ci */ 24462306a36Sopenharmony_ci#define DPNI_ERROR_FPE 0x00001000 24562306a36Sopenharmony_ci/** 24662306a36Sopenharmony_ci * DPNI_ERROR_PHE - Parsing header error 24762306a36Sopenharmony_ci */ 24862306a36Sopenharmony_ci#define DPNI_ERROR_PHE 0x00000020 24962306a36Sopenharmony_ci/** 25062306a36Sopenharmony_ci * DPNI_ERROR_L3CE - Parser L3 checksum error 25162306a36Sopenharmony_ci */ 25262306a36Sopenharmony_ci#define DPNI_ERROR_L3CE 0x00000004 25362306a36Sopenharmony_ci/** 25462306a36Sopenharmony_ci * DPNI_ERROR_L4CE - Parser L3 checksum error 25562306a36Sopenharmony_ci */ 25662306a36Sopenharmony_ci#define DPNI_ERROR_L4CE 0x00000001 25762306a36Sopenharmony_ci 25862306a36Sopenharmony_ci/** 25962306a36Sopenharmony_ci * enum dpni_error_action - Defines DPNI behavior for errors 26062306a36Sopenharmony_ci * @DPNI_ERROR_ACTION_DISCARD: Discard the frame 26162306a36Sopenharmony_ci * @DPNI_ERROR_ACTION_CONTINUE: Continue with the normal flow 26262306a36Sopenharmony_ci * @DPNI_ERROR_ACTION_SEND_TO_ERROR_QUEUE: Send the frame to the error queue 26362306a36Sopenharmony_ci */ 26462306a36Sopenharmony_cienum dpni_error_action { 26562306a36Sopenharmony_ci DPNI_ERROR_ACTION_DISCARD = 0, 26662306a36Sopenharmony_ci DPNI_ERROR_ACTION_CONTINUE = 1, 26762306a36Sopenharmony_ci DPNI_ERROR_ACTION_SEND_TO_ERROR_QUEUE = 2 26862306a36Sopenharmony_ci}; 26962306a36Sopenharmony_ci 27062306a36Sopenharmony_ci/** 27162306a36Sopenharmony_ci * struct dpni_error_cfg - Structure representing DPNI errors treatment 27262306a36Sopenharmony_ci * @errors: Errors mask; use 'DPNI_ERROR__<X> 27362306a36Sopenharmony_ci * @error_action: The desired action for the errors mask 27462306a36Sopenharmony_ci * @set_frame_annotation: Set to '1' to mark the errors in frame annotation 27562306a36Sopenharmony_ci * status (FAS); relevant only for the non-discard action 27662306a36Sopenharmony_ci */ 27762306a36Sopenharmony_cistruct dpni_error_cfg { 27862306a36Sopenharmony_ci u32 errors; 27962306a36Sopenharmony_ci enum dpni_error_action error_action; 28062306a36Sopenharmony_ci int set_frame_annotation; 28162306a36Sopenharmony_ci}; 28262306a36Sopenharmony_ci 28362306a36Sopenharmony_ciint dpni_set_errors_behavior(struct fsl_mc_io *mc_io, 28462306a36Sopenharmony_ci u32 cmd_flags, 28562306a36Sopenharmony_ci u16 token, 28662306a36Sopenharmony_ci struct dpni_error_cfg *cfg); 28762306a36Sopenharmony_ci 28862306a36Sopenharmony_ci/* DPNI buffer layout modification options */ 28962306a36Sopenharmony_ci 29062306a36Sopenharmony_ci/** 29162306a36Sopenharmony_ci * DPNI_BUF_LAYOUT_OPT_TIMESTAMP - Select to modify the time-stamp setting 29262306a36Sopenharmony_ci */ 29362306a36Sopenharmony_ci#define DPNI_BUF_LAYOUT_OPT_TIMESTAMP 0x00000001 29462306a36Sopenharmony_ci/** 29562306a36Sopenharmony_ci * DPNI_BUF_LAYOUT_OPT_PARSER_RESULT - Select to modify the parser-result 29662306a36Sopenharmony_ci * setting; not applicable for Tx 29762306a36Sopenharmony_ci */ 29862306a36Sopenharmony_ci#define DPNI_BUF_LAYOUT_OPT_PARSER_RESULT 0x00000002 29962306a36Sopenharmony_ci/** 30062306a36Sopenharmony_ci * DPNI_BUF_LAYOUT_OPT_FRAME_STATUS - Select to modify the frame-status setting 30162306a36Sopenharmony_ci */ 30262306a36Sopenharmony_ci#define DPNI_BUF_LAYOUT_OPT_FRAME_STATUS 0x00000004 30362306a36Sopenharmony_ci/** 30462306a36Sopenharmony_ci * DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE - Select to modify the private-data-size setting 30562306a36Sopenharmony_ci */ 30662306a36Sopenharmony_ci#define DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE 0x00000008 30762306a36Sopenharmony_ci/** 30862306a36Sopenharmony_ci * DPNI_BUF_LAYOUT_OPT_DATA_ALIGN - Select to modify the data-alignment setting 30962306a36Sopenharmony_ci */ 31062306a36Sopenharmony_ci#define DPNI_BUF_LAYOUT_OPT_DATA_ALIGN 0x00000010 31162306a36Sopenharmony_ci/** 31262306a36Sopenharmony_ci * DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM - Select to modify the data-head-room setting 31362306a36Sopenharmony_ci */ 31462306a36Sopenharmony_ci#define DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM 0x00000020 31562306a36Sopenharmony_ci/** 31662306a36Sopenharmony_ci * DPNI_BUF_LAYOUT_OPT_DATA_TAIL_ROOM - Select to modify the data-tail-room setting 31762306a36Sopenharmony_ci */ 31862306a36Sopenharmony_ci#define DPNI_BUF_LAYOUT_OPT_DATA_TAIL_ROOM 0x00000040 31962306a36Sopenharmony_ci 32062306a36Sopenharmony_ci/** 32162306a36Sopenharmony_ci * struct dpni_buffer_layout - Structure representing DPNI buffer layout 32262306a36Sopenharmony_ci * @options: Flags representing the suggested modifications to the buffer 32362306a36Sopenharmony_ci * layout; Use any combination of 'DPNI_BUF_LAYOUT_OPT_<X>' flags 32462306a36Sopenharmony_ci * @pass_timestamp: Pass timestamp value 32562306a36Sopenharmony_ci * @pass_parser_result: Pass parser results 32662306a36Sopenharmony_ci * @pass_frame_status: Pass frame status 32762306a36Sopenharmony_ci * @private_data_size: Size kept for private data (in bytes) 32862306a36Sopenharmony_ci * @data_align: Data alignment 32962306a36Sopenharmony_ci * @data_head_room: Data head room 33062306a36Sopenharmony_ci * @data_tail_room: Data tail room 33162306a36Sopenharmony_ci */ 33262306a36Sopenharmony_cistruct dpni_buffer_layout { 33362306a36Sopenharmony_ci u32 options; 33462306a36Sopenharmony_ci int pass_timestamp; 33562306a36Sopenharmony_ci int pass_parser_result; 33662306a36Sopenharmony_ci int pass_frame_status; 33762306a36Sopenharmony_ci u16 private_data_size; 33862306a36Sopenharmony_ci u16 data_align; 33962306a36Sopenharmony_ci u16 data_head_room; 34062306a36Sopenharmony_ci u16 data_tail_room; 34162306a36Sopenharmony_ci}; 34262306a36Sopenharmony_ci 34362306a36Sopenharmony_ci/** 34462306a36Sopenharmony_ci * enum dpni_queue_type - Identifies a type of queue targeted by the command 34562306a36Sopenharmony_ci * @DPNI_QUEUE_RX: Rx queue 34662306a36Sopenharmony_ci * @DPNI_QUEUE_TX: Tx queue 34762306a36Sopenharmony_ci * @DPNI_QUEUE_TX_CONFIRM: Tx confirmation queue 34862306a36Sopenharmony_ci * @DPNI_QUEUE_RX_ERR: Rx error queue 34962306a36Sopenharmony_ci */ 35062306a36Sopenharmony_cienum dpni_queue_type { 35162306a36Sopenharmony_ci DPNI_QUEUE_RX, 35262306a36Sopenharmony_ci DPNI_QUEUE_TX, 35362306a36Sopenharmony_ci DPNI_QUEUE_TX_CONFIRM, 35462306a36Sopenharmony_ci DPNI_QUEUE_RX_ERR, 35562306a36Sopenharmony_ci}; 35662306a36Sopenharmony_ci 35762306a36Sopenharmony_ciint dpni_get_buffer_layout(struct fsl_mc_io *mc_io, 35862306a36Sopenharmony_ci u32 cmd_flags, 35962306a36Sopenharmony_ci u16 token, 36062306a36Sopenharmony_ci enum dpni_queue_type qtype, 36162306a36Sopenharmony_ci struct dpni_buffer_layout *layout); 36262306a36Sopenharmony_ci 36362306a36Sopenharmony_ciint dpni_set_buffer_layout(struct fsl_mc_io *mc_io, 36462306a36Sopenharmony_ci u32 cmd_flags, 36562306a36Sopenharmony_ci u16 token, 36662306a36Sopenharmony_ci enum dpni_queue_type qtype, 36762306a36Sopenharmony_ci const struct dpni_buffer_layout *layout); 36862306a36Sopenharmony_ci 36962306a36Sopenharmony_ci/** 37062306a36Sopenharmony_ci * enum dpni_offload - Identifies a type of offload targeted by the command 37162306a36Sopenharmony_ci * @DPNI_OFF_RX_L3_CSUM: Rx L3 checksum validation 37262306a36Sopenharmony_ci * @DPNI_OFF_RX_L4_CSUM: Rx L4 checksum validation 37362306a36Sopenharmony_ci * @DPNI_OFF_TX_L3_CSUM: Tx L3 checksum generation 37462306a36Sopenharmony_ci * @DPNI_OFF_TX_L4_CSUM: Tx L4 checksum generation 37562306a36Sopenharmony_ci */ 37662306a36Sopenharmony_cienum dpni_offload { 37762306a36Sopenharmony_ci DPNI_OFF_RX_L3_CSUM, 37862306a36Sopenharmony_ci DPNI_OFF_RX_L4_CSUM, 37962306a36Sopenharmony_ci DPNI_OFF_TX_L3_CSUM, 38062306a36Sopenharmony_ci DPNI_OFF_TX_L4_CSUM, 38162306a36Sopenharmony_ci}; 38262306a36Sopenharmony_ci 38362306a36Sopenharmony_ciint dpni_set_offload(struct fsl_mc_io *mc_io, 38462306a36Sopenharmony_ci u32 cmd_flags, 38562306a36Sopenharmony_ci u16 token, 38662306a36Sopenharmony_ci enum dpni_offload type, 38762306a36Sopenharmony_ci u32 config); 38862306a36Sopenharmony_ci 38962306a36Sopenharmony_ciint dpni_get_offload(struct fsl_mc_io *mc_io, 39062306a36Sopenharmony_ci u32 cmd_flags, 39162306a36Sopenharmony_ci u16 token, 39262306a36Sopenharmony_ci enum dpni_offload type, 39362306a36Sopenharmony_ci u32 *config); 39462306a36Sopenharmony_ci 39562306a36Sopenharmony_ciint dpni_get_qdid(struct fsl_mc_io *mc_io, 39662306a36Sopenharmony_ci u32 cmd_flags, 39762306a36Sopenharmony_ci u16 token, 39862306a36Sopenharmony_ci enum dpni_queue_type qtype, 39962306a36Sopenharmony_ci u16 *qdid); 40062306a36Sopenharmony_ci 40162306a36Sopenharmony_ciint dpni_get_tx_data_offset(struct fsl_mc_io *mc_io, 40262306a36Sopenharmony_ci u32 cmd_flags, 40362306a36Sopenharmony_ci u16 token, 40462306a36Sopenharmony_ci u16 *data_offset); 40562306a36Sopenharmony_ci 40662306a36Sopenharmony_ci#define DPNI_STATISTICS_CNT 7 40762306a36Sopenharmony_ci 40862306a36Sopenharmony_ci/** 40962306a36Sopenharmony_ci * union dpni_statistics - Union describing the DPNI statistics 41062306a36Sopenharmony_ci * @page_0: Page_0 statistics structure 41162306a36Sopenharmony_ci * @page_0.ingress_all_frames: Ingress frame count 41262306a36Sopenharmony_ci * @page_0.ingress_all_bytes: Ingress byte count 41362306a36Sopenharmony_ci * @page_0.ingress_multicast_frames: Ingress multicast frame count 41462306a36Sopenharmony_ci * @page_0.ingress_multicast_bytes: Ingress multicast byte count 41562306a36Sopenharmony_ci * @page_0.ingress_broadcast_frames: Ingress broadcast frame count 41662306a36Sopenharmony_ci * @page_0.ingress_broadcast_bytes: Ingress broadcast byte count 41762306a36Sopenharmony_ci * @page_1: Page_1 statistics structure 41862306a36Sopenharmony_ci * @page_1.egress_all_frames: Egress frame count 41962306a36Sopenharmony_ci * @page_1.egress_all_bytes: Egress byte count 42062306a36Sopenharmony_ci * @page_1.egress_multicast_frames: Egress multicast frame count 42162306a36Sopenharmony_ci * @page_1.egress_multicast_bytes: Egress multicast byte count 42262306a36Sopenharmony_ci * @page_1.egress_broadcast_frames: Egress broadcast frame count 42362306a36Sopenharmony_ci * @page_1.egress_broadcast_bytes: Egress broadcast byte count 42462306a36Sopenharmony_ci * @page_2: Page_2 statistics structure 42562306a36Sopenharmony_ci * @page_2.ingress_filtered_frames: Ingress filtered frame count 42662306a36Sopenharmony_ci * @page_2.ingress_discarded_frames: Ingress discarded frame count 42762306a36Sopenharmony_ci * @page_2.ingress_nobuffer_discards: Ingress discarded frame count due to 42862306a36Sopenharmony_ci * lack of buffers 42962306a36Sopenharmony_ci * @page_2.egress_discarded_frames: Egress discarded frame count 43062306a36Sopenharmony_ci * @page_2.egress_confirmed_frames: Egress confirmed frame count 43162306a36Sopenharmony_ci * @page_3: Page_3 statistics structure 43262306a36Sopenharmony_ci * @page_3.egress_dequeue_bytes: Cumulative count of the number of bytes 43362306a36Sopenharmony_ci * dequeued from egress FQs 43462306a36Sopenharmony_ci * @page_3.egress_dequeue_frames: Cumulative count of the number of frames 43562306a36Sopenharmony_ci * dequeued from egress FQs 43662306a36Sopenharmony_ci * @page_3.egress_reject_bytes: Cumulative count of the number of bytes in 43762306a36Sopenharmony_ci * egress frames whose enqueue was rejected 43862306a36Sopenharmony_ci * @page_3.egress_reject_frames: Cumulative count of the number of egress 43962306a36Sopenharmony_ci * frames whose enqueue was rejected 44062306a36Sopenharmony_ci * @page_4: Page_4 statistics structure: congestion points 44162306a36Sopenharmony_ci * @page_4.cgr_reject_frames: number of rejected frames due to congestion point 44262306a36Sopenharmony_ci * @page_4.cgr_reject_bytes: number of rejected bytes due to congestion point 44362306a36Sopenharmony_ci * @page_5: Page_5 statistics structure: policer 44462306a36Sopenharmony_ci * @page_5.policer_cnt_red: NUmber of red colored frames 44562306a36Sopenharmony_ci * @page_5.policer_cnt_yellow: number of yellow colored frames 44662306a36Sopenharmony_ci * @page_5.policer_cnt_green: number of green colored frames 44762306a36Sopenharmony_ci * @page_5.policer_cnt_re_red: number of recolored red frames 44862306a36Sopenharmony_ci * @page_5.policer_cnt_re_yellow: number of recolored yellow frames 44962306a36Sopenharmony_ci * @page_6: Page_6 statistics structure 45062306a36Sopenharmony_ci * @page_6.tx_pending_frames: total number of frames pending in egress FQs 45162306a36Sopenharmony_ci * @raw: raw statistics structure, used to index counters 45262306a36Sopenharmony_ci */ 45362306a36Sopenharmony_ciunion dpni_statistics { 45462306a36Sopenharmony_ci struct { 45562306a36Sopenharmony_ci u64 ingress_all_frames; 45662306a36Sopenharmony_ci u64 ingress_all_bytes; 45762306a36Sopenharmony_ci u64 ingress_multicast_frames; 45862306a36Sopenharmony_ci u64 ingress_multicast_bytes; 45962306a36Sopenharmony_ci u64 ingress_broadcast_frames; 46062306a36Sopenharmony_ci u64 ingress_broadcast_bytes; 46162306a36Sopenharmony_ci } page_0; 46262306a36Sopenharmony_ci struct { 46362306a36Sopenharmony_ci u64 egress_all_frames; 46462306a36Sopenharmony_ci u64 egress_all_bytes; 46562306a36Sopenharmony_ci u64 egress_multicast_frames; 46662306a36Sopenharmony_ci u64 egress_multicast_bytes; 46762306a36Sopenharmony_ci u64 egress_broadcast_frames; 46862306a36Sopenharmony_ci u64 egress_broadcast_bytes; 46962306a36Sopenharmony_ci } page_1; 47062306a36Sopenharmony_ci struct { 47162306a36Sopenharmony_ci u64 ingress_filtered_frames; 47262306a36Sopenharmony_ci u64 ingress_discarded_frames; 47362306a36Sopenharmony_ci u64 ingress_nobuffer_discards; 47462306a36Sopenharmony_ci u64 egress_discarded_frames; 47562306a36Sopenharmony_ci u64 egress_confirmed_frames; 47662306a36Sopenharmony_ci } page_2; 47762306a36Sopenharmony_ci struct { 47862306a36Sopenharmony_ci u64 egress_dequeue_bytes; 47962306a36Sopenharmony_ci u64 egress_dequeue_frames; 48062306a36Sopenharmony_ci u64 egress_reject_bytes; 48162306a36Sopenharmony_ci u64 egress_reject_frames; 48262306a36Sopenharmony_ci } page_3; 48362306a36Sopenharmony_ci struct { 48462306a36Sopenharmony_ci u64 cgr_reject_frames; 48562306a36Sopenharmony_ci u64 cgr_reject_bytes; 48662306a36Sopenharmony_ci } page_4; 48762306a36Sopenharmony_ci struct { 48862306a36Sopenharmony_ci u64 policer_cnt_red; 48962306a36Sopenharmony_ci u64 policer_cnt_yellow; 49062306a36Sopenharmony_ci u64 policer_cnt_green; 49162306a36Sopenharmony_ci u64 policer_cnt_re_red; 49262306a36Sopenharmony_ci u64 policer_cnt_re_yellow; 49362306a36Sopenharmony_ci } page_5; 49462306a36Sopenharmony_ci struct { 49562306a36Sopenharmony_ci u64 tx_pending_frames; 49662306a36Sopenharmony_ci } page_6; 49762306a36Sopenharmony_ci struct { 49862306a36Sopenharmony_ci u64 counter[DPNI_STATISTICS_CNT]; 49962306a36Sopenharmony_ci } raw; 50062306a36Sopenharmony_ci}; 50162306a36Sopenharmony_ci 50262306a36Sopenharmony_ciint dpni_get_statistics(struct fsl_mc_io *mc_io, 50362306a36Sopenharmony_ci u32 cmd_flags, 50462306a36Sopenharmony_ci u16 token, 50562306a36Sopenharmony_ci u8 page, 50662306a36Sopenharmony_ci union dpni_statistics *stat); 50762306a36Sopenharmony_ci 50862306a36Sopenharmony_ci#define DPNI_LINK_OPT_AUTONEG 0x0000000000000001ULL 50962306a36Sopenharmony_ci#define DPNI_LINK_OPT_HALF_DUPLEX 0x0000000000000002ULL 51062306a36Sopenharmony_ci#define DPNI_LINK_OPT_PAUSE 0x0000000000000004ULL 51162306a36Sopenharmony_ci#define DPNI_LINK_OPT_ASYM_PAUSE 0x0000000000000008ULL 51262306a36Sopenharmony_ci#define DPNI_LINK_OPT_PFC_PAUSE 0x0000000000000010ULL 51362306a36Sopenharmony_ci 51462306a36Sopenharmony_ci/** 51562306a36Sopenharmony_ci * struct dpni_link_cfg - Structure representing DPNI link configuration 51662306a36Sopenharmony_ci * @rate: Rate 51762306a36Sopenharmony_ci * @options: Mask of available options; use 'DPNI_LINK_OPT_<X>' values 51862306a36Sopenharmony_ci */ 51962306a36Sopenharmony_cistruct dpni_link_cfg { 52062306a36Sopenharmony_ci u32 rate; 52162306a36Sopenharmony_ci u64 options; 52262306a36Sopenharmony_ci}; 52362306a36Sopenharmony_ci 52462306a36Sopenharmony_ciint dpni_set_link_cfg(struct fsl_mc_io *mc_io, 52562306a36Sopenharmony_ci u32 cmd_flags, 52662306a36Sopenharmony_ci u16 token, 52762306a36Sopenharmony_ci const struct dpni_link_cfg *cfg); 52862306a36Sopenharmony_ci 52962306a36Sopenharmony_ciint dpni_get_link_cfg(struct fsl_mc_io *mc_io, 53062306a36Sopenharmony_ci u32 cmd_flags, 53162306a36Sopenharmony_ci u16 token, 53262306a36Sopenharmony_ci struct dpni_link_cfg *cfg); 53362306a36Sopenharmony_ci 53462306a36Sopenharmony_ci/** 53562306a36Sopenharmony_ci * struct dpni_link_state - Structure representing DPNI link state 53662306a36Sopenharmony_ci * @rate: Rate 53762306a36Sopenharmony_ci * @options: Mask of available options; use 'DPNI_LINK_OPT_<X>' values 53862306a36Sopenharmony_ci * @up: Link state; '0' for down, '1' for up 53962306a36Sopenharmony_ci */ 54062306a36Sopenharmony_cistruct dpni_link_state { 54162306a36Sopenharmony_ci u32 rate; 54262306a36Sopenharmony_ci u64 options; 54362306a36Sopenharmony_ci int up; 54462306a36Sopenharmony_ci}; 54562306a36Sopenharmony_ci 54662306a36Sopenharmony_ciint dpni_get_link_state(struct fsl_mc_io *mc_io, 54762306a36Sopenharmony_ci u32 cmd_flags, 54862306a36Sopenharmony_ci u16 token, 54962306a36Sopenharmony_ci struct dpni_link_state *state); 55062306a36Sopenharmony_ci 55162306a36Sopenharmony_ciint dpni_set_max_frame_length(struct fsl_mc_io *mc_io, 55262306a36Sopenharmony_ci u32 cmd_flags, 55362306a36Sopenharmony_ci u16 token, 55462306a36Sopenharmony_ci u16 max_frame_length); 55562306a36Sopenharmony_ci 55662306a36Sopenharmony_ciint dpni_get_max_frame_length(struct fsl_mc_io *mc_io, 55762306a36Sopenharmony_ci u32 cmd_flags, 55862306a36Sopenharmony_ci u16 token, 55962306a36Sopenharmony_ci u16 *max_frame_length); 56062306a36Sopenharmony_ci 56162306a36Sopenharmony_ciint dpni_set_multicast_promisc(struct fsl_mc_io *mc_io, 56262306a36Sopenharmony_ci u32 cmd_flags, 56362306a36Sopenharmony_ci u16 token, 56462306a36Sopenharmony_ci int en); 56562306a36Sopenharmony_ci 56662306a36Sopenharmony_ciint dpni_get_multicast_promisc(struct fsl_mc_io *mc_io, 56762306a36Sopenharmony_ci u32 cmd_flags, 56862306a36Sopenharmony_ci u16 token, 56962306a36Sopenharmony_ci int *en); 57062306a36Sopenharmony_ci 57162306a36Sopenharmony_ciint dpni_set_unicast_promisc(struct fsl_mc_io *mc_io, 57262306a36Sopenharmony_ci u32 cmd_flags, 57362306a36Sopenharmony_ci u16 token, 57462306a36Sopenharmony_ci int en); 57562306a36Sopenharmony_ci 57662306a36Sopenharmony_ciint dpni_get_unicast_promisc(struct fsl_mc_io *mc_io, 57762306a36Sopenharmony_ci u32 cmd_flags, 57862306a36Sopenharmony_ci u16 token, 57962306a36Sopenharmony_ci int *en); 58062306a36Sopenharmony_ci 58162306a36Sopenharmony_ciint dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io, 58262306a36Sopenharmony_ci u32 cmd_flags, 58362306a36Sopenharmony_ci u16 token, 58462306a36Sopenharmony_ci const u8 mac_addr[6]); 58562306a36Sopenharmony_ci 58662306a36Sopenharmony_ciint dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io, 58762306a36Sopenharmony_ci u32 cmd_flags, 58862306a36Sopenharmony_ci u16 token, 58962306a36Sopenharmony_ci u8 mac_addr[6]); 59062306a36Sopenharmony_ci 59162306a36Sopenharmony_ciint dpni_get_port_mac_addr(struct fsl_mc_io *mc_io, 59262306a36Sopenharmony_ci u32 cm_flags, 59362306a36Sopenharmony_ci u16 token, 59462306a36Sopenharmony_ci u8 mac_addr[6]); 59562306a36Sopenharmony_ci 59662306a36Sopenharmony_ciint dpni_add_mac_addr(struct fsl_mc_io *mc_io, 59762306a36Sopenharmony_ci u32 cmd_flags, 59862306a36Sopenharmony_ci u16 token, 59962306a36Sopenharmony_ci const u8 mac_addr[6]); 60062306a36Sopenharmony_ci 60162306a36Sopenharmony_ciint dpni_remove_mac_addr(struct fsl_mc_io *mc_io, 60262306a36Sopenharmony_ci u32 cmd_flags, 60362306a36Sopenharmony_ci u16 token, 60462306a36Sopenharmony_ci const u8 mac_addr[6]); 60562306a36Sopenharmony_ci 60662306a36Sopenharmony_ciint dpni_clear_mac_filters(struct fsl_mc_io *mc_io, 60762306a36Sopenharmony_ci u32 cmd_flags, 60862306a36Sopenharmony_ci u16 token, 60962306a36Sopenharmony_ci int unicast, 61062306a36Sopenharmony_ci int multicast); 61162306a36Sopenharmony_ci 61262306a36Sopenharmony_ci/** 61362306a36Sopenharmony_ci * enum dpni_dist_mode - DPNI distribution mode 61462306a36Sopenharmony_ci * @DPNI_DIST_MODE_NONE: No distribution 61562306a36Sopenharmony_ci * @DPNI_DIST_MODE_HASH: Use hash distribution; only relevant if 61662306a36Sopenharmony_ci * the 'DPNI_OPT_DIST_HASH' option was set at DPNI creation 61762306a36Sopenharmony_ci * @DPNI_DIST_MODE_FS: Use explicit flow steering; only relevant if 61862306a36Sopenharmony_ci * the 'DPNI_OPT_DIST_FS' option was set at DPNI creation 61962306a36Sopenharmony_ci */ 62062306a36Sopenharmony_cienum dpni_dist_mode { 62162306a36Sopenharmony_ci DPNI_DIST_MODE_NONE = 0, 62262306a36Sopenharmony_ci DPNI_DIST_MODE_HASH = 1, 62362306a36Sopenharmony_ci DPNI_DIST_MODE_FS = 2 62462306a36Sopenharmony_ci}; 62562306a36Sopenharmony_ci 62662306a36Sopenharmony_ci/** 62762306a36Sopenharmony_ci * enum dpni_fs_miss_action - DPNI Flow Steering miss action 62862306a36Sopenharmony_ci * @DPNI_FS_MISS_DROP: In case of no-match, drop the frame 62962306a36Sopenharmony_ci * @DPNI_FS_MISS_EXPLICIT_FLOWID: In case of no-match, use explicit flow-id 63062306a36Sopenharmony_ci * @DPNI_FS_MISS_HASH: In case of no-match, distribute using hash 63162306a36Sopenharmony_ci */ 63262306a36Sopenharmony_cienum dpni_fs_miss_action { 63362306a36Sopenharmony_ci DPNI_FS_MISS_DROP = 0, 63462306a36Sopenharmony_ci DPNI_FS_MISS_EXPLICIT_FLOWID = 1, 63562306a36Sopenharmony_ci DPNI_FS_MISS_HASH = 2 63662306a36Sopenharmony_ci}; 63762306a36Sopenharmony_ci 63862306a36Sopenharmony_ci/** 63962306a36Sopenharmony_ci * struct dpni_fs_tbl_cfg - Flow Steering table configuration 64062306a36Sopenharmony_ci * @miss_action: Miss action selection 64162306a36Sopenharmony_ci * @default_flow_id: Used when 'miss_action = DPNI_FS_MISS_EXPLICIT_FLOWID' 64262306a36Sopenharmony_ci */ 64362306a36Sopenharmony_cistruct dpni_fs_tbl_cfg { 64462306a36Sopenharmony_ci enum dpni_fs_miss_action miss_action; 64562306a36Sopenharmony_ci u16 default_flow_id; 64662306a36Sopenharmony_ci}; 64762306a36Sopenharmony_ci 64862306a36Sopenharmony_ciint dpni_prepare_key_cfg(const struct dpkg_profile_cfg *cfg, 64962306a36Sopenharmony_ci u8 *key_cfg_buf); 65062306a36Sopenharmony_ci 65162306a36Sopenharmony_ci/** 65262306a36Sopenharmony_ci * struct dpni_rx_tc_dist_cfg - Rx traffic class distribution configuration 65362306a36Sopenharmony_ci * @dist_size: Set the distribution size; 65462306a36Sopenharmony_ci * supported values: 1,2,3,4,6,7,8,12,14,16,24,28,32,48,56,64,96, 65562306a36Sopenharmony_ci * 112,128,192,224,256,384,448,512,768,896,1024 65662306a36Sopenharmony_ci * @dist_mode: Distribution mode 65762306a36Sopenharmony_ci * @key_cfg_iova: I/O virtual address of 256 bytes DMA-able memory filled with 65862306a36Sopenharmony_ci * the extractions to be used for the distribution key by calling 65962306a36Sopenharmony_ci * dpni_prepare_key_cfg() relevant only when 66062306a36Sopenharmony_ci * 'dist_mode != DPNI_DIST_MODE_NONE', otherwise it can be '0' 66162306a36Sopenharmony_ci * @fs_cfg: Flow Steering table configuration; only relevant if 66262306a36Sopenharmony_ci * 'dist_mode = DPNI_DIST_MODE_FS' 66362306a36Sopenharmony_ci */ 66462306a36Sopenharmony_cistruct dpni_rx_tc_dist_cfg { 66562306a36Sopenharmony_ci u16 dist_size; 66662306a36Sopenharmony_ci enum dpni_dist_mode dist_mode; 66762306a36Sopenharmony_ci u64 key_cfg_iova; 66862306a36Sopenharmony_ci struct dpni_fs_tbl_cfg fs_cfg; 66962306a36Sopenharmony_ci}; 67062306a36Sopenharmony_ci 67162306a36Sopenharmony_ciint dpni_set_rx_tc_dist(struct fsl_mc_io *mc_io, 67262306a36Sopenharmony_ci u32 cmd_flags, 67362306a36Sopenharmony_ci u16 token, 67462306a36Sopenharmony_ci u8 tc_id, 67562306a36Sopenharmony_ci const struct dpni_rx_tc_dist_cfg *cfg); 67662306a36Sopenharmony_ci 67762306a36Sopenharmony_ci/** 67862306a36Sopenharmony_ci * DPNI_FS_MISS_DROP - When used for fs_miss_flow_id in function 67962306a36Sopenharmony_ci * dpni_set_rx_dist, will signal to dpni to drop all unclassified frames 68062306a36Sopenharmony_ci */ 68162306a36Sopenharmony_ci#define DPNI_FS_MISS_DROP ((uint16_t)-1) 68262306a36Sopenharmony_ci 68362306a36Sopenharmony_ci/** 68462306a36Sopenharmony_ci * struct dpni_rx_dist_cfg - Rx distribution configuration 68562306a36Sopenharmony_ci * @dist_size: distribution size 68662306a36Sopenharmony_ci * @key_cfg_iova: I/O virtual address of 256 bytes DMA-able memory filled with 68762306a36Sopenharmony_ci * the extractions to be used for the distribution key by calling 68862306a36Sopenharmony_ci * dpni_prepare_key_cfg(); relevant only when enable!=0 otherwise 68962306a36Sopenharmony_ci * it can be '0' 69062306a36Sopenharmony_ci * @enable: enable/disable the distribution. 69162306a36Sopenharmony_ci * @tc: TC id for which distribution is set 69262306a36Sopenharmony_ci * @fs_miss_flow_id: when packet misses all rules from flow steering table and 69362306a36Sopenharmony_ci * hash is disabled it will be put into this queue id; use 69462306a36Sopenharmony_ci * DPNI_FS_MISS_DROP to drop frames. The value of this field is 69562306a36Sopenharmony_ci * used only when flow steering distribution is enabled and hash 69662306a36Sopenharmony_ci * distribution is disabled 69762306a36Sopenharmony_ci */ 69862306a36Sopenharmony_cistruct dpni_rx_dist_cfg { 69962306a36Sopenharmony_ci u16 dist_size; 70062306a36Sopenharmony_ci u64 key_cfg_iova; 70162306a36Sopenharmony_ci u8 enable; 70262306a36Sopenharmony_ci u8 tc; 70362306a36Sopenharmony_ci u16 fs_miss_flow_id; 70462306a36Sopenharmony_ci}; 70562306a36Sopenharmony_ci 70662306a36Sopenharmony_ciint dpni_set_rx_fs_dist(struct fsl_mc_io *mc_io, 70762306a36Sopenharmony_ci u32 cmd_flags, 70862306a36Sopenharmony_ci u16 token, 70962306a36Sopenharmony_ci const struct dpni_rx_dist_cfg *cfg); 71062306a36Sopenharmony_ci 71162306a36Sopenharmony_ciint dpni_set_rx_hash_dist(struct fsl_mc_io *mc_io, 71262306a36Sopenharmony_ci u32 cmd_flags, 71362306a36Sopenharmony_ci u16 token, 71462306a36Sopenharmony_ci const struct dpni_rx_dist_cfg *cfg); 71562306a36Sopenharmony_ci 71662306a36Sopenharmony_ci/** 71762306a36Sopenharmony_ci * struct dpni_qos_tbl_cfg - Structure representing QOS table configuration 71862306a36Sopenharmony_ci * @key_cfg_iova: I/O virtual address of 256 bytes DMA-able memory filled with 71962306a36Sopenharmony_ci * key extractions to be used as the QoS criteria by calling 72062306a36Sopenharmony_ci * dpkg_prepare_key_cfg() 72162306a36Sopenharmony_ci * @discard_on_miss: Set to '1' to discard frames in case of no match (miss); 72262306a36Sopenharmony_ci * '0' to use the 'default_tc' in such cases 72362306a36Sopenharmony_ci * @default_tc: Used in case of no-match and 'discard_on_miss'= 0 72462306a36Sopenharmony_ci */ 72562306a36Sopenharmony_cistruct dpni_qos_tbl_cfg { 72662306a36Sopenharmony_ci u64 key_cfg_iova; 72762306a36Sopenharmony_ci int discard_on_miss; 72862306a36Sopenharmony_ci u8 default_tc; 72962306a36Sopenharmony_ci}; 73062306a36Sopenharmony_ci 73162306a36Sopenharmony_ciint dpni_set_qos_table(struct fsl_mc_io *mc_io, 73262306a36Sopenharmony_ci u32 cmd_flags, 73362306a36Sopenharmony_ci u16 token, 73462306a36Sopenharmony_ci const struct dpni_qos_tbl_cfg *cfg); 73562306a36Sopenharmony_ci 73662306a36Sopenharmony_ci/** 73762306a36Sopenharmony_ci * enum dpni_dest - DPNI destination types 73862306a36Sopenharmony_ci * @DPNI_DEST_NONE: Unassigned destination; The queue is set in parked mode and 73962306a36Sopenharmony_ci * does not generate FQDAN notifications; user is expected to 74062306a36Sopenharmony_ci * dequeue from the queue based on polling or other user-defined 74162306a36Sopenharmony_ci * method 74262306a36Sopenharmony_ci * @DPNI_DEST_DPIO: The queue is set in schedule mode and generates FQDAN 74362306a36Sopenharmony_ci * notifications to the specified DPIO; user is expected to dequeue 74462306a36Sopenharmony_ci * from the queue only after notification is received 74562306a36Sopenharmony_ci * @DPNI_DEST_DPCON: The queue is set in schedule mode and does not generate 74662306a36Sopenharmony_ci * FQDAN notifications, but is connected to the specified DPCON 74762306a36Sopenharmony_ci * object; user is expected to dequeue from the DPCON channel 74862306a36Sopenharmony_ci */ 74962306a36Sopenharmony_cienum dpni_dest { 75062306a36Sopenharmony_ci DPNI_DEST_NONE = 0, 75162306a36Sopenharmony_ci DPNI_DEST_DPIO = 1, 75262306a36Sopenharmony_ci DPNI_DEST_DPCON = 2 75362306a36Sopenharmony_ci}; 75462306a36Sopenharmony_ci 75562306a36Sopenharmony_ci/** 75662306a36Sopenharmony_ci * struct dpni_queue - Queue structure 75762306a36Sopenharmony_ci * @destination: - Destination structure 75862306a36Sopenharmony_ci * @destination.id: ID of the destination, only relevant if DEST_TYPE is > 0. 75962306a36Sopenharmony_ci * Identifies either a DPIO or a DPCON object. 76062306a36Sopenharmony_ci * Not relevant for Tx queues. 76162306a36Sopenharmony_ci * @destination.type: May be one of the following: 76262306a36Sopenharmony_ci * 0 - No destination, queue can be manually 76362306a36Sopenharmony_ci * queried, but will not push traffic or 76462306a36Sopenharmony_ci * notifications to a DPIO; 76562306a36Sopenharmony_ci * 1 - The destination is a DPIO. When traffic 76662306a36Sopenharmony_ci * becomes available in the queue a FQDAN 76762306a36Sopenharmony_ci * (FQ data available notification) will be 76862306a36Sopenharmony_ci * generated to selected DPIO; 76962306a36Sopenharmony_ci * 2 - The destination is a DPCON. The queue is 77062306a36Sopenharmony_ci * associated with a DPCON object for the 77162306a36Sopenharmony_ci * purpose of scheduling between multiple 77262306a36Sopenharmony_ci * queues. The DPCON may be independently 77362306a36Sopenharmony_ci * configured to generate notifications. 77462306a36Sopenharmony_ci * Not relevant for Tx queues. 77562306a36Sopenharmony_ci * @destination.hold_active: Hold active, maintains a queue scheduled for longer 77662306a36Sopenharmony_ci * in a DPIO during dequeue to reduce spread of traffic. 77762306a36Sopenharmony_ci * Only relevant if queues are 77862306a36Sopenharmony_ci * not affined to a single DPIO. 77962306a36Sopenharmony_ci * @user_context: User data, presented to the user along with any frames 78062306a36Sopenharmony_ci * from this queue. Not relevant for Tx queues. 78162306a36Sopenharmony_ci * @flc: FD FLow Context structure 78262306a36Sopenharmony_ci * @flc.value: Default FLC value for traffic dequeued from 78362306a36Sopenharmony_ci * this queue. Please check description of FD 78462306a36Sopenharmony_ci * structure for more information. 78562306a36Sopenharmony_ci * Note that FLC values set using dpni_add_fs_entry, 78662306a36Sopenharmony_ci * if any, take precedence over values per queue. 78762306a36Sopenharmony_ci * @flc.stash_control: Boolean, indicates whether the 6 lowest 78862306a36Sopenharmony_ci * - significant bits are used for stash control. 78962306a36Sopenharmony_ci * significant bits are used for stash control. If set, the 6 79062306a36Sopenharmony_ci * least significant bits in value are interpreted as follows: 79162306a36Sopenharmony_ci * - bits 0-1: indicates the number of 64 byte units of context 79262306a36Sopenharmony_ci * that are stashed. FLC value is interpreted as a memory address 79362306a36Sopenharmony_ci * in this case, excluding the 6 LS bits. 79462306a36Sopenharmony_ci * - bits 2-3: indicates the number of 64 byte units of frame 79562306a36Sopenharmony_ci * annotation to be stashed. Annotation is placed at FD[ADDR]. 79662306a36Sopenharmony_ci * - bits 4-5: indicates the number of 64 byte units of frame 79762306a36Sopenharmony_ci * data to be stashed. Frame data is placed at FD[ADDR] + 79862306a36Sopenharmony_ci * FD[OFFSET]. 79962306a36Sopenharmony_ci * For more details check the Frame Descriptor section in the 80062306a36Sopenharmony_ci * hardware documentation. 80162306a36Sopenharmony_ci */ 80262306a36Sopenharmony_cistruct dpni_queue { 80362306a36Sopenharmony_ci struct { 80462306a36Sopenharmony_ci u16 id; 80562306a36Sopenharmony_ci enum dpni_dest type; 80662306a36Sopenharmony_ci char hold_active; 80762306a36Sopenharmony_ci u8 priority; 80862306a36Sopenharmony_ci } destination; 80962306a36Sopenharmony_ci u64 user_context; 81062306a36Sopenharmony_ci struct { 81162306a36Sopenharmony_ci u64 value; 81262306a36Sopenharmony_ci char stash_control; 81362306a36Sopenharmony_ci } flc; 81462306a36Sopenharmony_ci}; 81562306a36Sopenharmony_ci 81662306a36Sopenharmony_ci/** 81762306a36Sopenharmony_ci * struct dpni_queue_id - Queue identification, used for enqueue commands 81862306a36Sopenharmony_ci * or queue control 81962306a36Sopenharmony_ci * @fqid: FQID used for enqueueing to and/or configuration of this specific FQ 82062306a36Sopenharmony_ci * @qdbin: Queueing bin, used to enqueue using QDID, DQBIN, QPRI. Only relevant 82162306a36Sopenharmony_ci * for Tx queues. 82262306a36Sopenharmony_ci */ 82362306a36Sopenharmony_cistruct dpni_queue_id { 82462306a36Sopenharmony_ci u32 fqid; 82562306a36Sopenharmony_ci u16 qdbin; 82662306a36Sopenharmony_ci}; 82762306a36Sopenharmony_ci 82862306a36Sopenharmony_ci/* Set User Context */ 82962306a36Sopenharmony_ci#define DPNI_QUEUE_OPT_USER_CTX 0x00000001 83062306a36Sopenharmony_ci#define DPNI_QUEUE_OPT_DEST 0x00000002 83162306a36Sopenharmony_ci#define DPNI_QUEUE_OPT_FLC 0x00000004 83262306a36Sopenharmony_ci#define DPNI_QUEUE_OPT_HOLD_ACTIVE 0x00000008 83362306a36Sopenharmony_ci 83462306a36Sopenharmony_ciint dpni_set_queue(struct fsl_mc_io *mc_io, 83562306a36Sopenharmony_ci u32 cmd_flags, 83662306a36Sopenharmony_ci u16 token, 83762306a36Sopenharmony_ci enum dpni_queue_type qtype, 83862306a36Sopenharmony_ci u8 tc, 83962306a36Sopenharmony_ci u8 index, 84062306a36Sopenharmony_ci u8 options, 84162306a36Sopenharmony_ci const struct dpni_queue *queue); 84262306a36Sopenharmony_ci 84362306a36Sopenharmony_ciint dpni_get_queue(struct fsl_mc_io *mc_io, 84462306a36Sopenharmony_ci u32 cmd_flags, 84562306a36Sopenharmony_ci u16 token, 84662306a36Sopenharmony_ci enum dpni_queue_type qtype, 84762306a36Sopenharmony_ci u8 tc, 84862306a36Sopenharmony_ci u8 index, 84962306a36Sopenharmony_ci struct dpni_queue *queue, 85062306a36Sopenharmony_ci struct dpni_queue_id *qid); 85162306a36Sopenharmony_ci 85262306a36Sopenharmony_ci/** 85362306a36Sopenharmony_ci * enum dpni_congestion_unit - DPNI congestion units 85462306a36Sopenharmony_ci * @DPNI_CONGESTION_UNIT_BYTES: bytes units 85562306a36Sopenharmony_ci * @DPNI_CONGESTION_UNIT_FRAMES: frames units 85662306a36Sopenharmony_ci */ 85762306a36Sopenharmony_cienum dpni_congestion_unit { 85862306a36Sopenharmony_ci DPNI_CONGESTION_UNIT_BYTES = 0, 85962306a36Sopenharmony_ci DPNI_CONGESTION_UNIT_FRAMES 86062306a36Sopenharmony_ci}; 86162306a36Sopenharmony_ci 86262306a36Sopenharmony_ci/** 86362306a36Sopenharmony_ci * enum dpni_congestion_point - Structure representing congestion point 86462306a36Sopenharmony_ci * @DPNI_CP_QUEUE: Set taildrop per queue, identified by QUEUE_TYPE, TC and 86562306a36Sopenharmony_ci * QUEUE_INDEX 86662306a36Sopenharmony_ci * @DPNI_CP_GROUP: Set taildrop per queue group. Depending on options used to 86762306a36Sopenharmony_ci * define the DPNI this can be either per TC (default) or per 86862306a36Sopenharmony_ci * interface (DPNI_OPT_SHARED_CONGESTION set at DPNI create). 86962306a36Sopenharmony_ci * QUEUE_INDEX is ignored if this type is used. 87062306a36Sopenharmony_ci */ 87162306a36Sopenharmony_cienum dpni_congestion_point { 87262306a36Sopenharmony_ci DPNI_CP_QUEUE, 87362306a36Sopenharmony_ci DPNI_CP_GROUP, 87462306a36Sopenharmony_ci}; 87562306a36Sopenharmony_ci 87662306a36Sopenharmony_ci/** 87762306a36Sopenharmony_ci * struct dpni_dest_cfg - Structure representing DPNI destination parameters 87862306a36Sopenharmony_ci * @dest_type: Destination type 87962306a36Sopenharmony_ci * @dest_id: Either DPIO ID or DPCON ID, depending on the destination type 88062306a36Sopenharmony_ci * @priority: Priority selection within the DPIO or DPCON channel; valid 88162306a36Sopenharmony_ci * values are 0-1 or 0-7, depending on the number of priorities 88262306a36Sopenharmony_ci * in that channel; not relevant for 'DPNI_DEST_NONE' option 88362306a36Sopenharmony_ci */ 88462306a36Sopenharmony_cistruct dpni_dest_cfg { 88562306a36Sopenharmony_ci enum dpni_dest dest_type; 88662306a36Sopenharmony_ci int dest_id; 88762306a36Sopenharmony_ci u8 priority; 88862306a36Sopenharmony_ci}; 88962306a36Sopenharmony_ci 89062306a36Sopenharmony_ci/* DPNI congestion options */ 89162306a36Sopenharmony_ci 89262306a36Sopenharmony_ci/** 89362306a36Sopenharmony_ci * DPNI_CONG_OPT_FLOW_CONTROL - This congestion will trigger flow control or 89462306a36Sopenharmony_ci * priority flow control. This will have effect only if flow control is 89562306a36Sopenharmony_ci * enabled with dpni_set_link_cfg(). 89662306a36Sopenharmony_ci */ 89762306a36Sopenharmony_ci#define DPNI_CONG_OPT_FLOW_CONTROL 0x00000040 89862306a36Sopenharmony_ci 89962306a36Sopenharmony_ci/** 90062306a36Sopenharmony_ci * struct dpni_congestion_notification_cfg - congestion notification 90162306a36Sopenharmony_ci * configuration 90262306a36Sopenharmony_ci * @units: Units type 90362306a36Sopenharmony_ci * @threshold_entry: Above this threshold we enter a congestion state. 90462306a36Sopenharmony_ci * set it to '0' to disable it 90562306a36Sopenharmony_ci * @threshold_exit: Below this threshold we exit the congestion state. 90662306a36Sopenharmony_ci * @message_ctx: The context that will be part of the CSCN message 90762306a36Sopenharmony_ci * @message_iova: I/O virtual address (must be in DMA-able memory), 90862306a36Sopenharmony_ci * must be 16B aligned; valid only if 'DPNI_CONG_OPT_WRITE_MEM_<X>' 90962306a36Sopenharmony_ci * is contained in 'options' 91062306a36Sopenharmony_ci * @dest_cfg: CSCN can be send to either DPIO or DPCON WQ channel 91162306a36Sopenharmony_ci * @notification_mode: Mask of available options; use 'DPNI_CONG_OPT_<X>' values 91262306a36Sopenharmony_ci */ 91362306a36Sopenharmony_ci 91462306a36Sopenharmony_cistruct dpni_congestion_notification_cfg { 91562306a36Sopenharmony_ci enum dpni_congestion_unit units; 91662306a36Sopenharmony_ci u32 threshold_entry; 91762306a36Sopenharmony_ci u32 threshold_exit; 91862306a36Sopenharmony_ci u64 message_ctx; 91962306a36Sopenharmony_ci u64 message_iova; 92062306a36Sopenharmony_ci struct dpni_dest_cfg dest_cfg; 92162306a36Sopenharmony_ci u16 notification_mode; 92262306a36Sopenharmony_ci}; 92362306a36Sopenharmony_ci 92462306a36Sopenharmony_ciint dpni_set_congestion_notification( 92562306a36Sopenharmony_ci struct fsl_mc_io *mc_io, 92662306a36Sopenharmony_ci u32 cmd_flags, 92762306a36Sopenharmony_ci u16 token, 92862306a36Sopenharmony_ci enum dpni_queue_type qtype, 92962306a36Sopenharmony_ci u8 tc_id, 93062306a36Sopenharmony_ci const struct dpni_congestion_notification_cfg *cfg); 93162306a36Sopenharmony_ci 93262306a36Sopenharmony_ci/** 93362306a36Sopenharmony_ci * struct dpni_taildrop - Structure representing the taildrop 93462306a36Sopenharmony_ci * @enable: Indicates whether the taildrop is active or not. 93562306a36Sopenharmony_ci * @units: Indicates the unit of THRESHOLD. Queue taildrop only supports 93662306a36Sopenharmony_ci * byte units, this field is ignored and assumed = 0 if 93762306a36Sopenharmony_ci * CONGESTION_POINT is 0. 93862306a36Sopenharmony_ci * @threshold: Threshold value, in units identified by UNITS field. Value 0 93962306a36Sopenharmony_ci * cannot be used as a valid taildrop threshold, THRESHOLD must 94062306a36Sopenharmony_ci * be > 0 if the taildrop is enabled. 94162306a36Sopenharmony_ci */ 94262306a36Sopenharmony_cistruct dpni_taildrop { 94362306a36Sopenharmony_ci char enable; 94462306a36Sopenharmony_ci enum dpni_congestion_unit units; 94562306a36Sopenharmony_ci u32 threshold; 94662306a36Sopenharmony_ci}; 94762306a36Sopenharmony_ci 94862306a36Sopenharmony_ciint dpni_set_taildrop(struct fsl_mc_io *mc_io, 94962306a36Sopenharmony_ci u32 cmd_flags, 95062306a36Sopenharmony_ci u16 token, 95162306a36Sopenharmony_ci enum dpni_congestion_point cg_point, 95262306a36Sopenharmony_ci enum dpni_queue_type q_type, 95362306a36Sopenharmony_ci u8 tc, 95462306a36Sopenharmony_ci u8 q_index, 95562306a36Sopenharmony_ci struct dpni_taildrop *taildrop); 95662306a36Sopenharmony_ci 95762306a36Sopenharmony_ciint dpni_get_taildrop(struct fsl_mc_io *mc_io, 95862306a36Sopenharmony_ci u32 cmd_flags, 95962306a36Sopenharmony_ci u16 token, 96062306a36Sopenharmony_ci enum dpni_congestion_point cg_point, 96162306a36Sopenharmony_ci enum dpni_queue_type q_type, 96262306a36Sopenharmony_ci u8 tc, 96362306a36Sopenharmony_ci u8 q_index, 96462306a36Sopenharmony_ci struct dpni_taildrop *taildrop); 96562306a36Sopenharmony_ci 96662306a36Sopenharmony_ci/** 96762306a36Sopenharmony_ci * struct dpni_rule_cfg - Rule configuration for table lookup 96862306a36Sopenharmony_ci * @key_iova: I/O virtual address of the key (must be in DMA-able memory) 96962306a36Sopenharmony_ci * @mask_iova: I/O virtual address of the mask (must be in DMA-able memory) 97062306a36Sopenharmony_ci * @key_size: key and mask size (in bytes) 97162306a36Sopenharmony_ci */ 97262306a36Sopenharmony_cistruct dpni_rule_cfg { 97362306a36Sopenharmony_ci u64 key_iova; 97462306a36Sopenharmony_ci u64 mask_iova; 97562306a36Sopenharmony_ci u8 key_size; 97662306a36Sopenharmony_ci}; 97762306a36Sopenharmony_ci 97862306a36Sopenharmony_ci/** 97962306a36Sopenharmony_ci * DPNI_FS_OPT_DISCARD - Discard matching traffic. If set, this takes 98062306a36Sopenharmony_ci * precedence over any other configuration and matching traffic is always 98162306a36Sopenharmony_ci * discarded. 98262306a36Sopenharmony_ci */ 98362306a36Sopenharmony_ci #define DPNI_FS_OPT_DISCARD 0x1 98462306a36Sopenharmony_ci 98562306a36Sopenharmony_ci/** 98662306a36Sopenharmony_ci * DPNI_FS_OPT_SET_FLC - Set FLC value. If set, flc member of struct 98762306a36Sopenharmony_ci * dpni_fs_action_cfg is used to override the FLC value set per queue. 98862306a36Sopenharmony_ci * For more details check the Frame Descriptor section in the hardware 98962306a36Sopenharmony_ci * documentation. 99062306a36Sopenharmony_ci */ 99162306a36Sopenharmony_ci#define DPNI_FS_OPT_SET_FLC 0x2 99262306a36Sopenharmony_ci 99362306a36Sopenharmony_ci/** 99462306a36Sopenharmony_ci * DPNI_FS_OPT_SET_STASH_CONTROL - Indicates whether the 6 lowest significant 99562306a36Sopenharmony_ci * bits of FLC are used for stash control. If set, the 6 least significant bits 99662306a36Sopenharmony_ci * in value are interpreted as follows: 99762306a36Sopenharmony_ci * - bits 0-1: indicates the number of 64 byte units of context that are 99862306a36Sopenharmony_ci * stashed. FLC value is interpreted as a memory address in this case, 99962306a36Sopenharmony_ci * excluding the 6 LS bits. 100062306a36Sopenharmony_ci * - bits 2-3: indicates the number of 64 byte units of frame annotation 100162306a36Sopenharmony_ci * to be stashed. Annotation is placed at FD[ADDR]. 100262306a36Sopenharmony_ci * - bits 4-5: indicates the number of 64 byte units of frame data to be 100362306a36Sopenharmony_ci * stashed. Frame data is placed at FD[ADDR] + FD[OFFSET]. 100462306a36Sopenharmony_ci * This flag is ignored if DPNI_FS_OPT_SET_FLC is not specified. 100562306a36Sopenharmony_ci */ 100662306a36Sopenharmony_ci#define DPNI_FS_OPT_SET_STASH_CONTROL 0x4 100762306a36Sopenharmony_ci 100862306a36Sopenharmony_ci/** 100962306a36Sopenharmony_ci * struct dpni_fs_action_cfg - Action configuration for table look-up 101062306a36Sopenharmony_ci * @flc: FLC value for traffic matching this rule. Please check the 101162306a36Sopenharmony_ci * Frame Descriptor section in the hardware documentation for 101262306a36Sopenharmony_ci * more information. 101362306a36Sopenharmony_ci * @flow_id: Identifies the Rx queue used for matching traffic. Supported 101462306a36Sopenharmony_ci * values are in range 0 to num_queue-1. 101562306a36Sopenharmony_ci * @options: Any combination of DPNI_FS_OPT_ values. 101662306a36Sopenharmony_ci */ 101762306a36Sopenharmony_cistruct dpni_fs_action_cfg { 101862306a36Sopenharmony_ci u64 flc; 101962306a36Sopenharmony_ci u16 flow_id; 102062306a36Sopenharmony_ci u16 options; 102162306a36Sopenharmony_ci}; 102262306a36Sopenharmony_ci 102362306a36Sopenharmony_ciint dpni_add_fs_entry(struct fsl_mc_io *mc_io, 102462306a36Sopenharmony_ci u32 cmd_flags, 102562306a36Sopenharmony_ci u16 token, 102662306a36Sopenharmony_ci u8 tc_id, 102762306a36Sopenharmony_ci u16 index, 102862306a36Sopenharmony_ci const struct dpni_rule_cfg *cfg, 102962306a36Sopenharmony_ci const struct dpni_fs_action_cfg *action); 103062306a36Sopenharmony_ci 103162306a36Sopenharmony_ciint dpni_remove_fs_entry(struct fsl_mc_io *mc_io, 103262306a36Sopenharmony_ci u32 cmd_flags, 103362306a36Sopenharmony_ci u16 token, 103462306a36Sopenharmony_ci u8 tc_id, 103562306a36Sopenharmony_ci const struct dpni_rule_cfg *cfg); 103662306a36Sopenharmony_ci 103762306a36Sopenharmony_ciint dpni_add_qos_entry(struct fsl_mc_io *mc_io, 103862306a36Sopenharmony_ci u32 cmd_flags, 103962306a36Sopenharmony_ci u16 token, 104062306a36Sopenharmony_ci const struct dpni_rule_cfg *cfg, 104162306a36Sopenharmony_ci u8 tc_id, 104262306a36Sopenharmony_ci u16 index); 104362306a36Sopenharmony_ci 104462306a36Sopenharmony_ciint dpni_remove_qos_entry(struct fsl_mc_io *mc_io, 104562306a36Sopenharmony_ci u32 cmd_flags, 104662306a36Sopenharmony_ci u16 token, 104762306a36Sopenharmony_ci const struct dpni_rule_cfg *cfg); 104862306a36Sopenharmony_ci 104962306a36Sopenharmony_ciint dpni_clear_qos_table(struct fsl_mc_io *mc_io, 105062306a36Sopenharmony_ci u32 cmd_flags, 105162306a36Sopenharmony_ci u16 token); 105262306a36Sopenharmony_ci 105362306a36Sopenharmony_ciint dpni_get_api_version(struct fsl_mc_io *mc_io, 105462306a36Sopenharmony_ci u32 cmd_flags, 105562306a36Sopenharmony_ci u16 *major_ver, 105662306a36Sopenharmony_ci u16 *minor_ver); 105762306a36Sopenharmony_ci/** 105862306a36Sopenharmony_ci * struct dpni_tx_shaping_cfg - Structure representing DPNI tx shaping configuration 105962306a36Sopenharmony_ci * @rate_limit: Rate in Mbps 106062306a36Sopenharmony_ci * @max_burst_size: Burst size in bytes (up to 64KB) 106162306a36Sopenharmony_ci */ 106262306a36Sopenharmony_cistruct dpni_tx_shaping_cfg { 106362306a36Sopenharmony_ci u32 rate_limit; 106462306a36Sopenharmony_ci u16 max_burst_size; 106562306a36Sopenharmony_ci}; 106662306a36Sopenharmony_ci 106762306a36Sopenharmony_ciint dpni_set_tx_shaping(struct fsl_mc_io *mc_io, 106862306a36Sopenharmony_ci u32 cmd_flags, 106962306a36Sopenharmony_ci u16 token, 107062306a36Sopenharmony_ci const struct dpni_tx_shaping_cfg *tx_cr_shaper, 107162306a36Sopenharmony_ci const struct dpni_tx_shaping_cfg *tx_er_shaper, 107262306a36Sopenharmony_ci int coupled); 107362306a36Sopenharmony_ci 107462306a36Sopenharmony_ci/** 107562306a36Sopenharmony_ci * struct dpni_single_step_cfg - configure single step PTP (IEEE 1588) 107662306a36Sopenharmony_ci * @en: enable single step PTP. When enabled the PTPv1 functionality 107762306a36Sopenharmony_ci * will not work. If the field is zero, offset and ch_update 107862306a36Sopenharmony_ci * parameters will be ignored 107962306a36Sopenharmony_ci * @offset: start offset from the beginning of the frame where 108062306a36Sopenharmony_ci * timestamp field is found. The offset must respect all MAC 108162306a36Sopenharmony_ci * headers, VLAN tags and other protocol headers 108262306a36Sopenharmony_ci * @ch_update: when set UDP checksum will be updated inside packet 108362306a36Sopenharmony_ci * @peer_delay: For peer-to-peer transparent clocks add this value to the 108462306a36Sopenharmony_ci * correction field in addition to the transient time update. 108562306a36Sopenharmony_ci * The value expresses nanoseconds. 108662306a36Sopenharmony_ci * @ptp_onestep_reg_base: 1588 SINGLE_STEP register base address. This address 108762306a36Sopenharmony_ci * is used to update directly the register contents. 108862306a36Sopenharmony_ci * User has to create an address mapping for it. 108962306a36Sopenharmony_ci * 109062306a36Sopenharmony_ci * 109162306a36Sopenharmony_ci */ 109262306a36Sopenharmony_cistruct dpni_single_step_cfg { 109362306a36Sopenharmony_ci u8 en; 109462306a36Sopenharmony_ci u8 ch_update; 109562306a36Sopenharmony_ci u16 offset; 109662306a36Sopenharmony_ci u32 peer_delay; 109762306a36Sopenharmony_ci u32 ptp_onestep_reg_base; 109862306a36Sopenharmony_ci}; 109962306a36Sopenharmony_ci 110062306a36Sopenharmony_ciint dpni_set_single_step_cfg(struct fsl_mc_io *mc_io, 110162306a36Sopenharmony_ci u32 cmd_flags, 110262306a36Sopenharmony_ci u16 token, 110362306a36Sopenharmony_ci struct dpni_single_step_cfg *ptp_cfg); 110462306a36Sopenharmony_ci 110562306a36Sopenharmony_ciint dpni_get_single_step_cfg(struct fsl_mc_io *mc_io, 110662306a36Sopenharmony_ci u32 cmd_flags, 110762306a36Sopenharmony_ci u16 token, 110862306a36Sopenharmony_ci struct dpni_single_step_cfg *ptp_cfg); 110962306a36Sopenharmony_ci 111062306a36Sopenharmony_ciint dpni_enable_vlan_filter(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, 111162306a36Sopenharmony_ci u32 en); 111262306a36Sopenharmony_ci 111362306a36Sopenharmony_ciint dpni_add_vlan_id(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, 111462306a36Sopenharmony_ci u16 vlan_id, u8 flags, u8 tc_id, u8 flow_id); 111562306a36Sopenharmony_ci 111662306a36Sopenharmony_ciint dpni_remove_vlan_id(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, 111762306a36Sopenharmony_ci u16 vlan_id); 111862306a36Sopenharmony_ci 111962306a36Sopenharmony_ci#endif /* __FSL_DPNI_H */ 1120