1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
3 * Copyright 2013-2016 Freescale Semiconductor Inc.
9 /* Data Path Communication Interface API
10 * Contains initialization APIs and runtime control APIs for DPCI
15 /** General DPCI macros */
18 * Maximum number of Tx/Rx priorities per DPCI object
20 #define DPCI_PRIO_NUM 2
23 * Indicates an invalid frame queue
25 #define DPCI_FQID_NOT_VALID (uint32_t)(-1)
28 * All queues considered; see dpci_set_rx_queue()
30 #define DPCI_ALL_QUEUES (uint8_t)(-1)
32 int dpci_open(struct fsl_mc_io *mc_io,
37 int dpci_close(struct fsl_mc_io *mc_io,
42 * Enable the Order Restoration support
44 #define DPCI_OPT_HAS_OPR 0x000040
47 * Order Point Records are shared for the entire DPCI
49 #define DPCI_OPT_OPR_SHARED 0x000080
52 * struct dpci_cfg - Structure representing DPCI configuration
53 * @options: Any combination of the following options:
56 * @num_of_priorities: Number of receive priorities (queues) for the DPCI;
57 * note, that the number of transmit priorities (queues)
58 * is determined by the number of receive priorities of
59 * the peer DPCI object
63 uint8_t num_of_priorities;
66 int dpci_create(struct fsl_mc_io *mc_io,
69 const struct dpci_cfg *cfg,
72 int dpci_destroy(struct fsl_mc_io *mc_io,
77 int dpci_enable(struct fsl_mc_io *mc_io,
81 int dpci_disable(struct fsl_mc_io *mc_io,
85 int dpci_is_enabled(struct fsl_mc_io *mc_io,
90 int dpci_reset(struct fsl_mc_io *mc_io,
95 * struct dpci_attr - Structure representing DPCI attributes
97 * @num_of_priorities: Number of receive priorities
101 uint8_t num_of_priorities;
104 int dpci_get_attributes(struct fsl_mc_io *mc_io,
107 struct dpci_attr *attr);
110 * enum dpci_dest - DPCI destination types
111 * @DPCI_DEST_NONE: Unassigned destination; The queue is set in parked mode
112 * and does not generate FQDAN notifications; user is
113 * expected to dequeue from the queue based on polling or
114 * other user-defined method
115 * @DPCI_DEST_DPIO: The queue is set in schedule mode and generates FQDAN
116 * notifications to the specified DPIO; user is expected
117 * to dequeue from the queue only after notification is
119 * @DPCI_DEST_DPCON: The queue is set in schedule mode and does not generate
120 * FQDAN notifications, but is connected to the specified
122 * user is expected to dequeue from the DPCON channel
131 * struct dpci_dest_cfg - Structure representing DPCI destination configuration
132 * @dest_type: Destination type
133 * @dest_id: Either DPIO ID or DPCON ID, depending on the destination type
134 * @priority: Priority selection within the DPIO or DPCON channel; valid
135 * values are 0-1 or 0-7, depending on the number of priorities
136 * in that channel; not relevant for 'DPCI_DEST_NONE' option
138 struct dpci_dest_cfg {
139 enum dpci_dest dest_type;
144 /** DPCI queue modification options */
147 * Select to modify the user's context associated with the queue
149 #define DPCI_QUEUE_OPT_USER_CTX 0x00000001
152 * Select to modify the queue's destination
154 #define DPCI_QUEUE_OPT_DEST 0x00000002
157 * struct dpci_rx_queue_cfg - Structure representing RX queue configuration
158 * @options: Flags representing the suggested modifications to the queue;
159 * Use any combination of 'DPCI_QUEUE_OPT_<X>' flags
160 * @user_ctx: User context value provided in the frame descriptor of each
162 * valid only if 'DPCI_QUEUE_OPT_USER_CTX' is contained in
164 * @dest_cfg: Queue destination parameters;
165 * valid only if 'DPCI_QUEUE_OPT_DEST' is contained in 'options'
167 struct dpci_rx_queue_cfg {
170 struct dpci_dest_cfg dest_cfg;
173 int dpci_set_rx_queue(struct fsl_mc_io *mc_io,
177 const struct dpci_rx_queue_cfg *cfg);
180 * struct dpci_rx_queue_attr - Structure representing Rx queue attributes
181 * @user_ctx: User context value provided in the frame descriptor of each
183 * @dest_cfg: Queue destination configuration
184 * @fqid: Virtual FQID value to be used for dequeue operations
186 struct dpci_rx_queue_attr {
188 struct dpci_dest_cfg dest_cfg;
192 int dpci_get_rx_queue(struct fsl_mc_io *mc_io,
196 struct dpci_rx_queue_attr *attr);
199 * struct dpci_tx_queue_attr - Structure representing attributes of Tx queues
200 * @fqid: Virtual FQID to be used for sending frames to peer DPCI;
201 * returns 'DPCI_FQID_NOT_VALID' if a no peer is connected or if
202 * the selected priority exceeds the number of priorities of the
205 struct dpci_tx_queue_attr {
209 int dpci_get_tx_queue(struct fsl_mc_io *mc_io,
213 struct dpci_tx_queue_attr *attr);
215 int dpci_get_api_version(struct fsl_mc_io *mc_io,
218 uint16_t *minor_ver);
220 #endif /* __FSL_DPCI_H */