// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) /* Copyright 2013-2016 Freescale Semiconductor Inc. * Copyright 2016 NXP * Copyright 2020 NXP */ #include <linux/kernel.h> #include <linux/errno.h> #include <linux/fsl/mc.h> #include "dpni.h" #include "dpni-cmd.h" /** * dpni_prepare_key_cfg() - function prepare extract parameters * @cfg: defining a full Key Generation profile (rule) * @key_cfg_buf: Zeroed 256 bytes of memory before mapping it to DMA * * This function has to be called before the following functions: * - dpni_set_rx_tc_dist() * - dpni_set_qos_table() * * Return: '0' on Success; Error code otherwise. */ int dpni_prepare_key_cfg(const struct dpkg_profile_cfg *cfg, u8 *key_cfg_buf) { … } /** * dpni_open() - Open a control session for the specified object * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @dpni_id: DPNI unique ID * @token: Returned token; use in subsequent API calls * * This function can be used to open a control session for an * already created object; an object may have been declared in * the DPL or by calling the dpni_create() function. * This function returns a unique authentication token, * associated with the specific object ID and the specific MC * portal; this token must be used in all subsequent commands for * this specific object. * * Return: '0' on Success; Error code otherwise. */ int dpni_open(struct fsl_mc_io *mc_io, u32 cmd_flags, int dpni_id, u16 *token) { … } /** * dpni_close() - Close the control session of the object * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * * After this function is called, no further operations are * allowed on the object without opening a new control session. * * Return: '0' on Success; Error code otherwise. */ int dpni_close(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token) { … } /** * dpni_set_pools() - Set buffer pools configuration * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @cfg: Buffer pools configuration * * mandatory for DPNI operation * warning:Allowed only when DPNI is disabled * * Return: '0' on Success; Error code otherwise. */ int dpni_set_pools(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, const struct dpni_pools_cfg *cfg) { … } /** * dpni_enable() - Enable the DPNI, allow sending and receiving frames. * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * * Return: '0' on Success; Error code otherwise. */ int dpni_enable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token) { … } /** * dpni_disable() - Disable the DPNI, stop sending and receiving frames. * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * * Return: '0' on Success; Error code otherwise. */ int dpni_disable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token) { … } /** * dpni_is_enabled() - Check if the DPNI is enabled. * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @en: Returns '1' if object is enabled; '0' otherwise * * Return: '0' on Success; Error code otherwise. */ int dpni_is_enabled(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, int *en) { … } /** * dpni_reset() - Reset the DPNI, returns the object to initial state. * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * * Return: '0' on Success; Error code otherwise. */ int dpni_reset(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token) { … } /** * dpni_set_irq_enable() - Set overall interrupt state. * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @irq_index: The interrupt index to configure * @en: Interrupt state: - enable = 1, disable = 0 * * Allows GPP software to control when interrupts are generated. * Each interrupt can have up to 32 causes. The enable/disable control's the * overall interrupt state. if the interrupt is disabled no causes will cause * an interrupt. * * Return: '0' on Success; Error code otherwise. */ int dpni_set_irq_enable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, u8 irq_index, u8 en) { … } /** * dpni_get_irq_enable() - Get overall interrupt state * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @irq_index: The interrupt index to configure * @en: Returned interrupt state - enable = 1, disable = 0 * * Return: '0' on Success; Error code otherwise. */ int dpni_get_irq_enable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, u8 irq_index, u8 *en) { … } /** * dpni_set_irq_mask() - Set interrupt mask. * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @irq_index: The interrupt index to configure * @mask: event mask to trigger interrupt; * each bit: * 0 = ignore event * 1 = consider event for asserting IRQ * * Every interrupt can have up to 32 causes and the interrupt model supports * masking/unmasking each cause independently * * Return: '0' on Success; Error code otherwise. */ int dpni_set_irq_mask(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, u8 irq_index, u32 mask) { … } /** * dpni_get_irq_mask() - Get interrupt mask. * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @irq_index: The interrupt index to configure * @mask: Returned event mask to trigger interrupt * * Every interrupt can have up to 32 causes and the interrupt model supports * masking/unmasking each cause independently * * Return: '0' on Success; Error code otherwise. */ int dpni_get_irq_mask(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, u8 irq_index, u32 *mask) { … } /** * dpni_get_irq_status() - Get the current status of any pending interrupts. * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @irq_index: The interrupt index to configure * @status: Returned interrupts status - one bit per cause: * 0 = no interrupt pending * 1 = interrupt pending * * Return: '0' on Success; Error code otherwise. */ int dpni_get_irq_status(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, u8 irq_index, u32 *status) { … } /** * dpni_clear_irq_status() - Clear a pending interrupt's status * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @irq_index: The interrupt index to configure * @status: bits to clear (W1C) - one bit per cause: * 0 = don't change * 1 = clear status bit * * Return: '0' on Success; Error code otherwise. */ int dpni_clear_irq_status(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, u8 irq_index, u32 status) { … } /** * dpni_get_attributes() - Retrieve DPNI attributes. * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @attr: Object's attributes * * Return: '0' on Success; Error code otherwise. */ int dpni_get_attributes(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, struct dpni_attr *attr) { … } /** * dpni_set_errors_behavior() - Set errors behavior * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @cfg: Errors configuration * * this function may be called numerous times with different * error masks * * Return: '0' on Success; Error code otherwise. */ int dpni_set_errors_behavior(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, struct dpni_error_cfg *cfg) { … } /** * dpni_get_buffer_layout() - Retrieve buffer layout attributes. * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @qtype: Type of queue to retrieve configuration for * @layout: Returns buffer layout attributes * * Return: '0' on Success; Error code otherwise. */ int dpni_get_buffer_layout(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, enum dpni_queue_type qtype, struct dpni_buffer_layout *layout) { … } /** * dpni_set_buffer_layout() - Set buffer layout configuration. * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @qtype: Type of queue this configuration applies to * @layout: Buffer layout configuration * * Return: '0' on Success; Error code otherwise. * * @warning Allowed only when DPNI is disabled */ int dpni_set_buffer_layout(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, enum dpni_queue_type qtype, const struct dpni_buffer_layout *layout) { … } /** * dpni_set_offload() - Set DPNI offload configuration. * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @type: Type of DPNI offload * @config: Offload configuration. * For checksum offloads, non-zero value enables the offload * * Return: '0' on Success; Error code otherwise. * * @warning Allowed only when DPNI is disabled */ int dpni_set_offload(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, enum dpni_offload type, u32 config) { … } int dpni_get_offload(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, enum dpni_offload type, u32 *config) { … } /** * dpni_get_qdid() - Get the Queuing Destination ID (QDID) that should be used * for enqueue operations * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @qtype: Type of queue to receive QDID for * @qdid: Returned virtual QDID value that should be used as an argument * in all enqueue operations * * Return: '0' on Success; Error code otherwise. */ int dpni_get_qdid(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, enum dpni_queue_type qtype, u16 *qdid) { … } /** * dpni_get_tx_data_offset() - Get the Tx data offset (from start of buffer) * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @data_offset: Tx data offset (from start of buffer) * * Return: '0' on Success; Error code otherwise. */ int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, u16 *data_offset) { … } /** * dpni_set_link_cfg() - set the link configuration. * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @cfg: Link configuration * * Return: '0' on Success; Error code otherwise. */ int dpni_set_link_cfg(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, const struct dpni_link_cfg *cfg) { … } /** * dpni_get_link_cfg() - return the link configuration * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @cfg: Link configuration from dpni object * * Return: '0' on Success; Error code otherwise. */ int dpni_get_link_cfg(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, struct dpni_link_cfg *cfg) { … } /** * dpni_get_link_state() - Return the link state (either up or down) * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @state: Returned link state; * * Return: '0' on Success; Error code otherwise. */ int dpni_get_link_state(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, struct dpni_link_state *state) { … } /** * dpni_set_max_frame_length() - Set the maximum received frame length. * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @max_frame_length: Maximum received frame length (in * bytes); frame is discarded if its * length exceeds this value * * Return: '0' on Success; Error code otherwise. */ int dpni_set_max_frame_length(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, u16 max_frame_length) { … } /** * dpni_get_max_frame_length() - Get the maximum received frame length. * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @max_frame_length: Maximum received frame length (in * bytes); frame is discarded if its * length exceeds this value * * Return: '0' on Success; Error code otherwise. */ int dpni_get_max_frame_length(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, u16 *max_frame_length) { … } /** * dpni_set_multicast_promisc() - Enable/disable multicast promiscuous mode * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @en: Set to '1' to enable; '0' to disable * * Return: '0' on Success; Error code otherwise. */ int dpni_set_multicast_promisc(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, int en) { … } /** * dpni_get_multicast_promisc() - Get multicast promiscuous mode * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @en: Returns '1' if enabled; '0' otherwise * * Return: '0' on Success; Error code otherwise. */ int dpni_get_multicast_promisc(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, int *en) { … } /** * dpni_set_unicast_promisc() - Enable/disable unicast promiscuous mode * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @en: Set to '1' to enable; '0' to disable * * Return: '0' on Success; Error code otherwise. */ int dpni_set_unicast_promisc(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, int en) { … } /** * dpni_get_unicast_promisc() - Get unicast promiscuous mode * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @en: Returns '1' if enabled; '0' otherwise * * Return: '0' on Success; Error code otherwise. */ int dpni_get_unicast_promisc(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, int *en) { … } /** * dpni_set_primary_mac_addr() - Set the primary MAC address * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @mac_addr: MAC address to set as primary address * * Return: '0' on Success; Error code otherwise. */ int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, const u8 mac_addr[6]) { … } /** * dpni_get_primary_mac_addr() - Get the primary MAC address * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @mac_addr: Returned MAC address * * Return: '0' on Success; Error code otherwise. */ int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, u8 mac_addr[6]) { … } /** * dpni_get_port_mac_addr() - Retrieve MAC address associated to the physical * port the DPNI is attached to * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @mac_addr: MAC address of the physical port, if any, otherwise 0 * * The primary MAC address is not cleared by this operation. * * Return: '0' on Success; Error code otherwise. */ int dpni_get_port_mac_addr(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, u8 mac_addr[6]) { … } /** * dpni_enable_vlan_filter() - Enable/disable VLAN filtering mode * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @en: Set to '1' to enable; '0' to disable * * Return: '0' on Success; Error code otherwise. */ int dpni_enable_vlan_filter(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, u32 en) { … } /** * dpni_add_vlan_id() - Add VLAN ID filter * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @vlan_id: VLAN ID to add * @flags: 0 - tc_id and flow_id will be ignored. * Pkt with this vlan_id will be passed to the next * classification stages * DPNI_VLAN_SET_QUEUE_ACTION * Pkt with this vlan_id will be forward directly to * queue defined by the tc_id and flow_id * * @tc_id: Traffic class selection (0-7) * @flow_id: Selects the specific queue out of the set allocated for the * same as tc_id. Value must be in range 0 to NUM_QUEUES - 1 * * Return: '0' on Success; Error code otherwise. */ int dpni_add_vlan_id(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, u16 vlan_id, u8 flags, u8 tc_id, u8 flow_id) { … } /** * dpni_remove_vlan_id() - Remove VLAN ID filter * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @vlan_id: VLAN ID to remove * * Return: '0' on Success; Error code otherwise. */ int dpni_remove_vlan_id(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, u16 vlan_id) { … } /** * dpni_add_mac_addr() - Add MAC address filter * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @mac_addr: MAC address to add * * Return: '0' on Success; Error code otherwise. */ int dpni_add_mac_addr(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, const u8 mac_addr[6]) { … } /** * dpni_remove_mac_addr() - Remove MAC address filter * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @mac_addr: MAC address to remove * * Return: '0' on Success; Error code otherwise. */ int dpni_remove_mac_addr(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, const u8 mac_addr[6]) { … } /** * dpni_clear_mac_filters() - Clear all unicast and/or multicast MAC filters * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @unicast: Set to '1' to clear unicast addresses * @multicast: Set to '1' to clear multicast addresses * * The primary MAC address is not cleared by this operation. * * Return: '0' on Success; Error code otherwise. */ int dpni_clear_mac_filters(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, int unicast, int multicast) { … } /** * dpni_set_rx_tc_dist() - Set Rx traffic class distribution configuration * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @tc_id: Traffic class selection (0-7) * @cfg: Traffic class distribution configuration * * warning: if 'dist_mode != DPNI_DIST_MODE_NONE', call dpni_prepare_key_cfg() * first to prepare the key_cfg_iova parameter * * Return: '0' on Success; error code otherwise. */ int dpni_set_rx_tc_dist(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, u8 tc_id, const struct dpni_rx_tc_dist_cfg *cfg) { … } /** * dpni_set_congestion_notification() - Set traffic class congestion * notification configuration * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @qtype: Type of queue - Rx, Tx and Tx confirm types are supported * @tc_id: Traffic class selection (0-7) * @cfg: Congestion notification configuration * * Return: '0' on Success; error code otherwise. */ int dpni_set_congestion_notification( struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, enum dpni_queue_type qtype, u8 tc_id, const struct dpni_congestion_notification_cfg *cfg) { … } /** * dpni_set_queue() - Set queue parameters * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @qtype: Type of queue - all queue types are supported, although * the command is ignored for Tx * @tc: Traffic class, in range 0 to NUM_TCS - 1 * @index: Selects the specific queue out of the set allocated for the * same TC. Value must be in range 0 to NUM_QUEUES - 1 * @options: A combination of DPNI_QUEUE_OPT_ values that control what * configuration options are set on the queue * @queue: Queue structure * * Return: '0' on Success; Error code otherwise. */ int dpni_set_queue(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, enum dpni_queue_type qtype, u8 tc, u8 index, u8 options, const struct dpni_queue *queue) { … } /** * dpni_get_queue() - Get queue parameters * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @qtype: Type of queue - all queue types are supported * @tc: Traffic class, in range 0 to NUM_TCS - 1 * @index: Selects the specific queue out of the set allocated for the * same TC. Value must be in range 0 to NUM_QUEUES - 1 * @queue: Queue configuration structure * @qid: Queue identification * * Return: '0' on Success; Error code otherwise. */ int dpni_get_queue(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, enum dpni_queue_type qtype, u8 tc, u8 index, struct dpni_queue *queue, struct dpni_queue_id *qid) { … } /** * dpni_get_statistics() - Get DPNI statistics * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @page: Selects the statistics page to retrieve, see * DPNI_GET_STATISTICS output. Pages are numbered 0 to 6. * @stat: Structure containing the statistics * * Return: '0' on Success; Error code otherwise. */ int dpni_get_statistics(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, u8 page, union dpni_statistics *stat) { … } /** * dpni_set_taildrop() - Set taildrop per queue or TC * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @cg_point: Congestion point * @qtype: Queue type on which the taildrop is configured. * Only Rx queues are supported for now * @tc: Traffic class to apply this taildrop to * @index: Index of the queue if the DPNI supports multiple queues for * traffic distribution. Ignored if CONGESTION_POINT is not 0. * @taildrop: Taildrop structure * * Return: '0' on Success; Error code otherwise. */ int dpni_set_taildrop(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, enum dpni_congestion_point cg_point, enum dpni_queue_type qtype, u8 tc, u8 index, struct dpni_taildrop *taildrop) { … } /** * dpni_get_taildrop() - Get taildrop information * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @cg_point: Congestion point * @qtype: Queue type on which the taildrop is configured. * Only Rx queues are supported for now * @tc: Traffic class to apply this taildrop to * @index: Index of the queue if the DPNI supports multiple queues for * traffic distribution. Ignored if CONGESTION_POINT is not 0. * @taildrop: Taildrop structure * * Return: '0' on Success; Error code otherwise. */ int dpni_get_taildrop(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, enum dpni_congestion_point cg_point, enum dpni_queue_type qtype, u8 tc, u8 index, struct dpni_taildrop *taildrop) { … } /** * dpni_get_api_version() - Get Data Path Network Interface API version * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @major_ver: Major version of data path network interface API * @minor_ver: Minor version of data path network interface API * * Return: '0' on Success; Error code otherwise. */ int dpni_get_api_version(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 *major_ver, u16 *minor_ver) { … } /** * dpni_set_rx_fs_dist() - Set Rx flow steering distribution * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @cfg: Distribution configuration * * If the FS is already enabled with a previous call the classification * key will be changed but all the table rules are kept. If the * existing rules do not match the key the results will not be * predictable. It is the user responsibility to keep key integrity. * If cfg.enable is set to 1 the command will create a flow steering table * and will classify packets according to this table. The packets that * miss all the table rules will be classified according to settings * made in dpni_set_rx_hash_dist() * If cfg.enable is set to 0 the command will clear flow steering table. * The packets will be classified according to settings made in * dpni_set_rx_hash_dist() * * Return: '0' on Success; Error code otherwise. */ int dpni_set_rx_fs_dist(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, const struct dpni_rx_dist_cfg *cfg) { … } /** * dpni_set_rx_hash_dist() - Set Rx hash distribution * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @cfg: Distribution configuration * If cfg.enable is set to 1 the packets will be classified using a hash * function based on the key received in cfg.key_cfg_iova parameter. * If cfg.enable is set to 0 the packets will be sent to the default queue * * Return: '0' on Success; Error code otherwise. */ int dpni_set_rx_hash_dist(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, const struct dpni_rx_dist_cfg *cfg) { … } /** * dpni_add_fs_entry() - Add Flow Steering entry for a specific traffic class * (to select a flow ID) * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @tc_id: Traffic class selection (0-7) * @index: Location in the FS table where to insert the entry. * Only relevant if MASKING is enabled for FS * classification on this DPNI, it is ignored for exact match. * @cfg: Flow steering rule to add * @action: Action to be taken as result of a classification hit * * Return: '0' on Success; Error code otherwise. */ int dpni_add_fs_entry(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, u8 tc_id, u16 index, const struct dpni_rule_cfg *cfg, const struct dpni_fs_action_cfg *action) { … } /** * dpni_remove_fs_entry() - Remove Flow Steering entry from a specific * traffic class * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @tc_id: Traffic class selection (0-7) * @cfg: Flow steering rule to remove * * Return: '0' on Success; Error code otherwise. */ int dpni_remove_fs_entry(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, u8 tc_id, const struct dpni_rule_cfg *cfg) { … } /** * dpni_set_qos_table() - Set QoS mapping table * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @cfg: QoS table configuration * * This function and all QoS-related functions require that *'max_tcs > 1' was set at DPNI creation. * * warning: Before calling this function, call dpkg_prepare_key_cfg() to * prepare the key_cfg_iova parameter * * Return: '0' on Success; Error code otherwise. */ int dpni_set_qos_table(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, const struct dpni_qos_tbl_cfg *cfg) { … } /** * dpni_add_qos_entry() - Add QoS mapping entry (to select a traffic class) * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @cfg: QoS rule to add * @tc_id: Traffic class selection (0-7) * @index: Location in the QoS table where to insert the entry. * Only relevant if MASKING is enabled for QoS classification on * this DPNI, it is ignored for exact match. * * Return: '0' on Success; Error code otherwise. */ int dpni_add_qos_entry(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, const struct dpni_rule_cfg *cfg, u8 tc_id, u16 index) { … } /** * dpni_remove_qos_entry() - Remove QoS mapping entry * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @cfg: QoS rule to remove * * Return: '0' on Success; Error code otherwise. */ int dpni_remove_qos_entry(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, const struct dpni_rule_cfg *cfg) { … } /** * dpni_clear_qos_table() - Clear all QoS mapping entries * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * * Following this function call, all frames are directed to * the default traffic class (0) * * Return: '0' on Success; Error code otherwise. */ int dpni_clear_qos_table(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token) { … } /** * dpni_set_tx_shaping() - Set the transmit shaping * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @tx_cr_shaper: TX committed rate shaping configuration * @tx_er_shaper: TX excess rate shaping configuration * @coupled: Committed and excess rate shapers are coupled * * Return: '0' on Success; Error code otherwise. */ int dpni_set_tx_shaping(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, const struct dpni_tx_shaping_cfg *tx_cr_shaper, const struct dpni_tx_shaping_cfg *tx_er_shaper, int coupled) { … } /** * dpni_get_single_step_cfg() - return current configuration for * single step PTP * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @ptp_cfg: ptp single step configuration * * Return: '0' on Success; Error code otherwise. * */ int dpni_get_single_step_cfg(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, struct dpni_single_step_cfg *ptp_cfg) { … } /** * dpni_set_single_step_cfg() - enable/disable and configure single step PTP * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @ptp_cfg: ptp single step configuration * * Return: '0' on Success; Error code otherwise. * * The function has effect only when dpni object is connected to a dpmac * object. If the dpni is not connected to a dpmac the configuration will * be stored inside and applied when connection is made. */ int dpni_set_single_step_cfg(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, struct dpni_single_step_cfg *ptp_cfg) { … }