ef14f8581e40058845b96eb60fb43a7db27a326a
[deb_dpdk.git] / drivers / net / dpaa2 / mc / fsl_dpni.h
1 /*-
2  * This file is provided under a dual BSD/GPLv2 license. When using or
3  * redistributing this file, you may do so under either license.
4  *
5  *   BSD LICENSE
6  *
7  * Copyright 2013-2016 Freescale Semiconductor Inc.
8  * Copyright (c) 2016 NXP.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions are met:
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution.
17  * * Neither the name of the above-listed copyright holders nor the
18  * names of any contributors may be used to endorse or promote products
19  * derived from this software without specific prior written permission.
20  *
21  *   GPL LICENSE SUMMARY
22  *
23  * ALTERNATIVELY, this software may be distributed under the terms of the
24  * GNU General Public License ("GPL") as published by the Free Software
25  * Foundation, either version 2 of that License or (at your option) any
26  * later version.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
32  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38  * POSSIBILITY OF SUCH DAMAGE.
39  */
40 #ifndef __FSL_DPNI_H
41 #define __FSL_DPNI_H
42
43 #include <fsl_dpkg.h>
44
45 struct fsl_mc_io;
46
47 /**
48  * Data Path Network Interface API
49  * Contains initialization APIs and runtime control APIs for DPNI
50  */
51
52 /** General DPNI macros */
53
54 /**
55  * Maximum number of traffic classes
56  */
57 #define DPNI_MAX_TC                             8
58 /**
59  * Maximum number of buffer pools per DPNI
60  */
61 #define DPNI_MAX_DPBP                           8
62 /**
63  * Maximum number of storage-profiles per DPNI
64  */
65 #define DPNI_MAX_SP                             2
66
67 /**
68  * All traffic classes considered; see dpni_set_queue()
69  */
70 #define DPNI_ALL_TCS                            (uint8_t)(-1)
71 /**
72  * All flows within traffic class considered; see dpni_set_queue()
73  */
74 #define DPNI_ALL_TC_FLOWS                       (uint16_t)(-1)
75 /**
76  * Generate new flow ID; see dpni_set_queue()
77  */
78 #define DPNI_NEW_FLOW_ID                        (uint16_t)(-1)
79 /**
80  * Tx traffic is always released to a buffer pool on transmit, there are no
81  * resources allocated to have the frames confirmed back to the source after
82  * transmission.
83  */
84 #define DPNI_OPT_TX_FRM_RELEASE                 0x000001
85 /**
86  * Disables support for MAC address filtering for addresses other than primary
87  * MAC address. This affects both unicast and multicast. Promiscuous mode can
88  * still be enabled/disabled for both unicast and multicast. If promiscuous mode
89  * is disabled, only traffic matching the primary MAC address will be accepted.
90  */
91 #define DPNI_OPT_NO_MAC_FILTER                  0x000002
92 /**
93  * Allocate policers for this DPNI. They can be used to rate-limit traffic per
94  * traffic class (TC) basis.
95  */
96 #define DPNI_OPT_HAS_POLICING                   0x000004
97 /**
98  * Congestion can be managed in several ways, allowing the buffer pool to
99  * deplete on ingress, taildrop on each queue or use congestion groups for sets
100  * of queues. If set, it configures a single congestion groups across all TCs.
101  * If reset, a congestion group is allocated for each TC. Only relevant if the
102  * DPNI has multiple traffic classes.
103  */
104 #define DPNI_OPT_SHARED_CONGESTION              0x000008
105 /**
106  * Enables TCAM for Flow Steering and QoS look-ups. If not specified, all
107  * look-ups are exact match. Note that TCAM is not available on LS1088 and its
108  * variants. Setting this bit on these SoCs will trigger an error.
109  */
110 #define DPNI_OPT_HAS_KEY_MASKING                0x000010
111 /**
112  * Disables the flow steering table.
113  */
114 #define DPNI_OPT_NO_FS                          0x000020
115
116 /**
117  * dpni_open() - Open a control session for the specified object
118  * @mc_io:      Pointer to MC portal's I/O object
119  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
120  * @dpni_id:    DPNI unique ID
121  * @token:      Returned token; use in subsequent API calls
122  *
123  * This function can be used to open a control session for an
124  * already created object; an object may have been declared in
125  * the DPL or by calling the dpni_create() function.
126  * This function returns a unique authentication token,
127  * associated with the specific object ID and the specific MC
128  * portal; this token must be used in all subsequent commands for
129  * this specific object.
130  *
131  * Return:      '0' on Success; Error code otherwise.
132  */
133 int dpni_open(struct fsl_mc_io  *mc_io,
134               uint32_t          cmd_flags,
135               int               dpni_id,
136               uint16_t          *token);
137
138 /**
139  * dpni_close() - Close the control session of the object
140  * @mc_io:      Pointer to MC portal's I/O object
141  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
142  * @token:      Token of DPNI object
143  *
144  * After this function is called, no further operations are
145  * allowed on the object without opening a new control session.
146  *
147  * Return:      '0' on Success; Error code otherwise.
148  */
149 int dpni_close(struct fsl_mc_io *mc_io,
150                uint32_t         cmd_flags,
151                uint16_t         token);
152
153 /**
154  * struct dpni_cfg - Structure representing DPNI configuration
155  * @mac_addr: Primary MAC address
156  * @adv: Advanced parameters; default is all zeros;
157  *              use this structure to change default settings
158  */
159 struct dpni_cfg {
160         /**
161          * @options: Any combination of the following options:
162          *              DPNI_OPT_TX_FRM_RELEASE
163          *              DPNI_OPT_NO_MAC_FILTER
164          *              DPNI_OPT_HAS_POLICING
165          *              DPNI_OPT_SHARED_CONGESTION
166          *              DPNI_OPT_HAS_KEY_MASKING
167          *              DPNI_OPT_NO_FS
168          * @fs_entries: Number of entries in the flow steering table.
169          *              This table is used to select the ingress queue for
170          *              ingress traffic, targeting a GPP core or another.
171          *              In addition it can be used to discard traffic that
172          *              matches the set rule. It is either an exact match table
173          *              or a TCAM table, depending on DPNI_OPT_ HAS_KEY_MASKING
174          *              bit in OPTIONS field. This field is ignored if
175          *              DPNI_OPT_NO_FS bit is set in OPTIONS field. Otherwise,
176          *              value 0 defaults to 64. Maximum supported value is 1024.
177          *              Note that the total number of entries is limited on the
178          *              SoC to as low as 512 entries if TCAM is used.
179          * @vlan_filter_entries: Number of entries in the VLAN address filtering
180          *              table. This is an exact match table used to filter
181          *              ingress traffic based on VLAN IDs. Value 0 disables VLAN
182          *              filtering. Maximum supported value is 16.
183          * @mac_filter_entries: Number of entries in the MAC address filtering
184          *              table. This is an exact match table and allows both
185          *              unicast and multicast entries. The primary MAC address
186          *              of the network interface is not part of this table,
187          *              this contains only entries in addition to it. This
188          *              field is ignored if DPNI_OPT_ NO_MAC_FILTER is set in
189          *              OPTIONS field. Otherwise, value 0 defaults to 80.
190          *              Maximum supported value is 80.
191          * @num_queues: Number of Tx and Rx queues used for traffic
192          *              distribution. This is orthogonal to QoS and is only
193          *              used to distribute traffic to multiple GPP cores.
194          *              This configuration affects the number of Tx queues
195          *              (logical FQs, all associated with a single CEETM queue),
196          *              Rx queues and Tx confirmation queues, if applicable.
197          *              Value 0 defaults to one queue. Maximum supported value
198          *              is 8.
199          * @num_tcs: Number of traffic classes (TCs), reserved for the DPNI.
200          *              TCs can have different priority levels for the purpose
201          *              of Tx scheduling (see DPNI_SET_TX_SELECTION), different
202          *              BPs (DPNI_ SET_POOLS), policers. There are dedicated QM
203          *              queues for traffic classes (including class queues on
204          *              Tx). Value 0 defaults to one TC. Maximum supported value
205          *              is 8.
206          * @qos_entries: Number of entries in the QoS classification table. This
207          *              table is used to select the TC for ingress traffic. It
208          *              is either an exact match or a TCAM table, depending on
209          *              DPNI_OPT_ HAS_KEY_MASKING bit in OPTIONS field. This
210          *              field is ignored if the DPNI has a single TC. Otherwise,
211          *              a value of 0 defaults to 64. Maximum supported value
212          *              is 64.
213          */
214         uint32_t options;
215         uint16_t fs_entries;
216         uint8_t  vlan_filter_entries;
217         uint8_t  mac_filter_entries;
218         uint8_t  num_queues;
219         uint8_t  num_tcs;
220         uint8_t  qos_entries;
221 };
222
223 /**
224  * dpni_create() - Create the DPNI object
225  * @mc_io:      Pointer to MC portal's I/O object
226  * @dprc_token: Parent container token; '0' for default container
227  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
228  * @cfg:        Configuration structure
229  * @obj_id: returned object id
230  *
231  * Create the DPNI object, allocate required resources and
232  * perform required initialization.
233  *
234  * The object can be created either by declaring it in the
235  * DPL file, or by calling this function.
236  *
237  * The function accepts an authentication token of a parent
238  * container that this object should be assigned to. The token
239  * can be '0' so the object will be assigned to the default container.
240  * The newly created object can be opened with the returned
241  * object id and using the container's associated tokens and MC portals.
242  *
243  * Return:      '0' on Success; Error code otherwise.
244  */
245 int dpni_create(struct fsl_mc_io        *mc_io,
246                 uint16_t                dprc_token,
247                 uint32_t                cmd_flags,
248                 const struct dpni_cfg   *cfg,
249                 uint32_t                *obj_id);
250
251 /**
252  * dpni_destroy() - Destroy the DPNI object and release all its resources.
253  * @mc_io:      Pointer to MC portal's I/O object
254  * @dprc_token: Parent container token; '0' for default container
255  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
256  * @object_id:  The object id; it must be a valid id within the container that
257  * created this object;
258  *
259  * The function accepts the authentication token of the parent container that
260  * created the object (not the one that currently owns the object). The object
261  * is searched within parent using the provided 'object_id'.
262  * All tokens to the object must be closed before calling destroy.
263  *
264  * Return:      '0' on Success; error code otherwise.
265  */
266 int dpni_destroy(struct fsl_mc_io       *mc_io,
267                  uint16_t               dprc_token,
268                  uint32_t               cmd_flags,
269                  uint32_t               object_id);
270
271 /**
272  * struct dpni_pools_cfg - Structure representing buffer pools configuration
273  * @num_dpbp: Number of DPBPs
274  * @pools: Array of buffer pools parameters; The number of valid entries
275  *      must match 'num_dpbp' value
276  */
277 struct dpni_pools_cfg {
278         uint8_t         num_dpbp;
279         /**
280          * struct pools - Buffer pools parameters
281          * @dpbp_id: DPBP object ID
282          * @buffer_size: Buffer size
283          * @backup_pool: Backup pool
284          */
285         struct {
286                 int             dpbp_id;
287                 uint16_t        buffer_size;
288                 int             backup_pool;
289         } pools[DPNI_MAX_DPBP];
290 };
291
292 /**
293  * dpni_set_pools() - Set buffer pools configuration
294  * @mc_io:      Pointer to MC portal's I/O object
295  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
296  * @token:      Token of DPNI object
297  * @cfg:        Buffer pools configuration
298  *
299  * mandatory for DPNI operation
300  * warning:Allowed only when DPNI is disabled
301  *
302  * Return:      '0' on Success; Error code otherwise.
303  */
304 int dpni_set_pools(struct fsl_mc_io             *mc_io,
305                    uint32_t                     cmd_flags,
306                    uint16_t                     token,
307                    const struct dpni_pools_cfg  *cfg);
308
309 /**
310  * dpni_enable() - Enable the DPNI, allow sending and receiving frames.
311  * @mc_io:      Pointer to MC portal's I/O object
312  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
313  * @token:              Token of DPNI object
314  *
315  * Return:      '0' on Success; Error code otherwise.
316  */
317 int dpni_enable(struct fsl_mc_io        *mc_io,
318                 uint32_t                cmd_flags,
319                 uint16_t                token);
320
321 /**
322  * dpni_disable() - Disable the DPNI, stop sending and receiving frames.
323  * @mc_io:      Pointer to MC portal's I/O object
324  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
325  * @token:      Token of DPNI object
326  *
327  * Return:      '0' on Success; Error code otherwise.
328  */
329 int dpni_disable(struct fsl_mc_io       *mc_io,
330                  uint32_t               cmd_flags,
331                  uint16_t               token);
332
333 /**
334  * dpni_is_enabled() - Check if the DPNI is enabled.
335  * @mc_io:      Pointer to MC portal's I/O object
336  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
337  * @token:      Token of DPNI object
338  * @en:         Returns '1' if object is enabled; '0' otherwise
339  *
340  * Return:      '0' on Success; Error code otherwise.
341  */
342 int dpni_is_enabled(struct fsl_mc_io    *mc_io,
343                     uint32_t            cmd_flags,
344                     uint16_t            token,
345                     int                 *en);
346
347 /**
348  * dpni_reset() - Reset the DPNI, returns the object to initial state.
349  * @mc_io:      Pointer to MC portal's I/O object
350  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
351  * @token:      Token of DPNI object
352  *
353  * Return:      '0' on Success; Error code otherwise.
354  */
355 int dpni_reset(struct fsl_mc_io *mc_io,
356                uint32_t         cmd_flags,
357                uint16_t         token);
358
359 /**
360  * struct dpni_attr - Structure representing DPNI attributes
361  * @options: Any combination of the following options:
362  *              DPNI_OPT_TX_FRM_RELEASE
363  *              DPNI_OPT_NO_MAC_FILTER
364  *              DPNI_OPT_HAS_POLICING
365  *              DPNI_OPT_SHARED_CONGESTION
366  *              DPNI_OPT_HAS_KEY_MASKING
367  *              DPNI_OPT_NO_FS
368  * @num_queues: Number of Tx and Rx queues used for traffic distribution.
369  * @num_tcs: Number of traffic classes (TCs), reserved for the DPNI.
370  * @mac_filter_entries: Number of entries in the MAC address filtering
371  *              table.
372  * @vlan_filter_entries: Number of entries in the VLAN address filtering
373  *              table.
374  * @qos_entries: Number of entries in the QoS classification table.
375  * @fs_entries: Number of entries in the flow steering table.
376  * @qos_key_size: Size, in bytes, of the QoS look-up key. Defining a key larger
377  *                      than this when adding QoS entries will result
378  *                      in an error.
379  * @fs_key_size: Size, in bytes, of the flow steering look-up key. Defining a
380  *                      key larger than this when composing the hash + FS key
381  *                      will result in an error.
382  * @wriop_version: Version of WRIOP HW block.
383  *                      The 3 version values are stored on 6, 5, 5 bits
384  *                      respectively.
385  *                      Values returned:
386  *                      - 0x400 - WRIOP version 1.0.0, used on LS2080 and
387  *                      variants,
388  *                      - 0x421 - WRIOP version 1.1.1, used on LS2088 and
389  *                      variants,
390  *                      - 0x422 - WRIOP version 1.1.2, used on LS1088 and
391  *                      variants.
392  */
393 struct dpni_attr {
394         uint32_t options;
395         uint8_t  num_queues;
396         uint8_t  num_tcs;
397         uint8_t  mac_filter_entries;
398         uint8_t  vlan_filter_entries;
399         uint8_t  qos_entries;
400         uint16_t fs_entries;
401         uint8_t  qos_key_size;
402         uint8_t  fs_key_size;
403         uint16_t wriop_version;
404 };
405
406 /**
407  * dpni_get_attributes() - Retrieve DPNI attributes.
408  * @mc_io:      Pointer to MC portal's I/O object
409  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
410  * @token:      Token of DPNI object
411  * @attr:       Object's attributes
412  *
413  * Return:      '0' on Success; Error code otherwise.
414  */
415 int dpni_get_attributes(struct fsl_mc_io        *mc_io,
416                         uint32_t                cmd_flags,
417                         uint16_t                token,
418                         struct dpni_attr        *attr);
419
420 /**
421  * DPNI errors
422  */
423
424 /**
425  * Extract out of frame header error
426  */
427 #define DPNI_ERROR_EOFHE        0x00020000
428 /**
429  * Frame length error
430  */
431 #define DPNI_ERROR_FLE          0x00002000
432 /**
433  * Frame physical error
434  */
435 #define DPNI_ERROR_FPE          0x00001000
436 /**
437  * Parsing header error
438  */
439 #define DPNI_ERROR_PHE          0x00000020
440 /**
441  * Parser L3 checksum error
442  */
443 #define DPNI_ERROR_L3CE         0x00000004
444 /**
445  * Parser L3 checksum error
446  */
447 #define DPNI_ERROR_L4CE         0x00000001
448
449 /**
450  * enum dpni_error_action - Defines DPNI behavior for errors
451  * @DPNI_ERROR_ACTION_DISCARD: Discard the frame
452  * @DPNI_ERROR_ACTION_CONTINUE: Continue with the normal flow
453  * @DPNI_ERROR_ACTION_SEND_TO_ERROR_QUEUE: Send the frame to the error queue
454  */
455 enum dpni_error_action {
456         DPNI_ERROR_ACTION_DISCARD = 0,
457         DPNI_ERROR_ACTION_CONTINUE = 1,
458         DPNI_ERROR_ACTION_SEND_TO_ERROR_QUEUE = 2
459 };
460
461 /**
462  * struct dpni_error_cfg - Structure representing DPNI errors treatment
463  * @errors: Errors mask; use 'DPNI_ERROR__<X>
464  * @error_action: The desired action for the errors mask
465  * @set_frame_annotation: Set to '1' to mark the errors in frame annotation
466  *              status (FAS); relevant only for the non-discard action
467  */
468 struct dpni_error_cfg {
469         uint32_t                errors;
470         enum dpni_error_action  error_action;
471         int                     set_frame_annotation;
472 };
473
474 /**
475  * dpni_set_errors_behavior() - Set errors behavior
476  * @mc_io:      Pointer to MC portal's I/O object
477  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
478  * @token:      Token of DPNI object
479  * @cfg:        Errors configuration
480  *
481  * this function may be called numerous times with different
482  * error masks
483  *
484  * Return:      '0' on Success; Error code otherwise.
485  */
486 int dpni_set_errors_behavior(struct fsl_mc_io           *mc_io,
487                              uint32_t                   cmd_flags,
488                              uint16_t                   token,
489                              struct dpni_error_cfg      *cfg);
490
491 /**
492  * DPNI buffer layout modification options
493  */
494
495 /**
496  * Select to modify the time-stamp setting
497  */
498 #define DPNI_BUF_LAYOUT_OPT_TIMESTAMP           0x00000001
499 /**
500  * Select to modify the parser-result setting; not applicable for Tx
501  */
502 #define DPNI_BUF_LAYOUT_OPT_PARSER_RESULT       0x00000002
503 /**
504  * Select to modify the frame-status setting
505  */
506 #define DPNI_BUF_LAYOUT_OPT_FRAME_STATUS        0x00000004
507 /**
508  * Select to modify the private-data-size setting
509  */
510 #define DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE   0x00000008
511 /**
512  * Select to modify the data-alignment setting
513  */
514 #define DPNI_BUF_LAYOUT_OPT_DATA_ALIGN          0x00000010
515 /**
516  * Select to modify the data-head-room setting
517  */
518 #define DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM      0x00000020
519 /**
520  * Select to modify the data-tail-room setting
521  */
522 #define DPNI_BUF_LAYOUT_OPT_DATA_TAIL_ROOM      0x00000040
523
524 /**
525  * struct dpni_buffer_layout - Structure representing DPNI buffer layout
526  * @options: Flags representing the suggested modifications to the buffer
527  *              layout; Use any combination of 'DPNI_BUF_LAYOUT_OPT_<X>' flags
528  * @pass_timestamp: Pass timestamp value
529  * @pass_parser_result: Pass parser results
530  * @pass_frame_status: Pass frame status
531  * @private_data_size: Size kept for private data (in bytes)
532  * @data_align: Data alignment
533  * @data_head_room: Data head room
534  * @data_tail_room: Data tail room
535  */
536 struct dpni_buffer_layout {
537         uint32_t        options;
538         int             pass_timestamp;
539         int             pass_parser_result;
540         int             pass_frame_status;
541         uint16_t        private_data_size;
542         uint16_t        data_align;
543         uint16_t        data_head_room;
544         uint16_t        data_tail_room;
545 };
546
547 /**
548  * enum dpni_queue_type - Identifies a type of queue targeted by the command
549  * @DPNI_QUEUE_RX: Rx queue
550  * @DPNI_QUEUE_TX: Tx queue
551  * @DPNI_QUEUE_TX_CONFIRM: Tx confirmation queue
552  * @DPNI_QUEUE_RX_ERR: Rx error queue
553  */enum dpni_queue_type {
554         DPNI_QUEUE_RX,
555         DPNI_QUEUE_TX,
556         DPNI_QUEUE_TX_CONFIRM,
557         DPNI_QUEUE_RX_ERR,
558 };
559
560 /**
561  * dpni_get_buffer_layout() - Retrieve buffer layout attributes.
562  * @mc_io:      Pointer to MC portal's I/O object
563  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
564  * @token:      Token of DPNI object
565  * @qtype:      Type of queue to get the layout from
566  * @layout:     Returns buffer layout attributes
567  *
568  * Return:      '0' on Success; Error code otherwise.
569  */
570 int dpni_get_buffer_layout(struct fsl_mc_io             *mc_io,
571                            uint32_t                     cmd_flags,
572                            uint16_t                     token,
573                            enum dpni_queue_type         qtype,
574                            struct dpni_buffer_layout    *layout);
575
576 /**
577  * dpni_set_buffer_layout() - Set buffer layout configuration.
578  * @mc_io:      Pointer to MC portal's I/O object
579  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
580  * @token:      Token of DPNI object
581  * @qtype:      Type of queue to set layout on
582  * @layout:     Buffer layout configuration
583  *
584  * Return:      '0' on Success; Error code otherwise.
585  *
586  * @warning     Allowed only when DPNI is disabled
587  */
588 int dpni_set_buffer_layout(struct fsl_mc_io                *mc_io,
589                            uint32_t                        cmd_flags,
590                            uint16_t                        token,
591                            enum dpni_queue_type            qtype,
592                            const struct dpni_buffer_layout *layout);
593
594 /**
595  * enum dpni_offload - Identifies a type of offload targeted by the command
596  * @DPNI_OFF_RX_L3_CSUM: Rx L3 checksum validation
597  * @DPNI_OFF_RX_L4_CSUM: Rx L4 checksum validation
598  * @DPNI_OFF_TX_L3_CSUM: Tx L3 checksum generation
599  * @DPNI_OFF_TX_L4_CSUM: Tx L4 checksum generation
600  */
601 enum dpni_offload {
602         DPNI_OFF_RX_L3_CSUM,
603         DPNI_OFF_RX_L4_CSUM,
604         DPNI_OFF_TX_L3_CSUM,
605         DPNI_OFF_TX_L4_CSUM,
606 };
607
608 /**
609  * dpni_set_offload() - Set DPNI offload configuration.
610  * @mc_io:      Pointer to MC portal's I/O object
611  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
612  * @token:      Token of DPNI object
613  * @type:       Type of DPNI offload
614  * @config:     Offload configuration.
615  *                      For checksum offloads, non-zero value enables
616  *                      the offload.
617  *
618  * Return:      '0' on Success; Error code otherwise.
619  *
620  * @warning     Allowed only when DPNI is disabled
621  */
622 int dpni_set_offload(struct fsl_mc_io *mc_io,
623                      uint32_t cmd_flags,
624                      uint16_t token,
625                      enum dpni_offload type,
626                      uint32_t config);
627
628 /**
629  * dpni_get_offload() - Get DPNI offload configuration.
630  * @mc_io:      Pointer to MC portal's I/O object
631  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
632  * @token:      Token of DPNI object
633  * @type:       Type of DPNI offload
634  * @config:     Offload configuration.
635  *                      For checksum offloads, a value of 1 indicates that the
636  *                      offload is enabled.
637  *
638  * Return:      '0' on Success; Error code otherwise.
639  *
640  * @warning     Allowed only when DPNI is disabled
641  */
642 int dpni_get_offload(struct fsl_mc_io *mc_io,
643                      uint32_t cmd_flags,
644                      uint16_t token,
645                      enum dpni_offload type,
646                      uint32_t *config);
647
648 /**
649  * dpni_get_qdid() - Get the Queuing Destination ID (QDID) that should be used
650  *                      for enqueue operations
651  * @mc_io:      Pointer to MC portal's I/O object
652  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
653  * @token:      Token of DPNI object
654  * @qtype:      Type of queue to get QDID for.  For applications lookig to
655  *              transmit traffic this should be set to DPNI_QUEUE_TX
656  * @qdid:       Returned virtual QDID value that should be used as an argument
657  *                      in all enqueue operations
658  *
659  * Return:      '0' on Success; Error code otherwise.
660  */
661 int dpni_get_qdid(struct fsl_mc_io      *mc_io,
662                   uint32_t              cmd_flags,
663                   uint16_t              token,
664                   enum dpni_queue_type  qtype,
665                   uint16_t              *qdid);
666
667 #define DPNI_STATISTICS_CNT             7
668
669 union dpni_statistics {
670         /**
671          * struct page_0 - Page_0 statistics structure
672          * @ingress_all_frames: Ingress frame count
673          * @ingress_all_bytes: Ingress byte count
674          * @ingress_multicast_frames: Ingress multicast frame count
675          * @ingress_multicast_bytes: Ingress multicast byte count
676          * @ingress_broadcast_frames: Ingress broadcast frame count
677          * @ingress_broadcast_bytes: Ingress broadcast byte count
678          */
679         struct {
680                 uint64_t ingress_all_frames;
681                 uint64_t ingress_all_bytes;
682                 uint64_t ingress_multicast_frames;
683                 uint64_t ingress_multicast_bytes;
684                 uint64_t ingress_broadcast_frames;
685                 uint64_t ingress_broadcast_bytes;
686         } page_0;
687         /**
688          * struct page_1 - Page_1 statistics structure
689          * @egress_all_frames: Egress frame count
690          * @egress_all_bytes: Egress byte count
691          * @egress_multicast_frames: Egress multicast frame count
692          * @egress_multicast_bytes: Egress multicast byte count
693          * @egress_broadcast_frames: Egress broadcast frame count
694          * @egress_broadcast_bytes: Egress broadcast byte count
695          */
696         struct {
697                 uint64_t egress_all_frames;
698                 uint64_t egress_all_bytes;
699                 uint64_t egress_multicast_frames;
700                 uint64_t egress_multicast_bytes;
701                 uint64_t egress_broadcast_frames;
702                 uint64_t egress_broadcast_bytes;
703         } page_1;
704         /**
705          * struct page_2 - Page_2 statistics structure
706          * @ingress_filtered_frames: Ingress filtered frame count
707          * @ingress_discarded_frames: Ingress discarded frame count
708          * @ingress_nobuffer_discards: Ingress discarded frame count due to
709          *                                      lack of buffers
710          * @egress_discarded_frames: Egress discarded frame count
711          * @egress_confirmed_frames: Egress confirmed frame count
712          */
713         struct {
714                 uint64_t ingress_filtered_frames;
715                 uint64_t ingress_discarded_frames;
716                 uint64_t ingress_nobuffer_discards;
717                 uint64_t egress_discarded_frames;
718                 uint64_t egress_confirmed_frames;
719         } page_2;
720         /**
721          * struct raw - raw statistics structure, used to index counters
722          */
723         struct {
724                 uint64_t counter[DPNI_STATISTICS_CNT];
725         } raw;
726 };
727
728 /**
729  * Enable auto-negotiation
730  */
731 #define DPNI_LINK_OPT_AUTONEG           0x0000000000000001ULL
732 /**
733  * Enable half-duplex mode
734  */
735 #define DPNI_LINK_OPT_HALF_DUPLEX       0x0000000000000002ULL
736 /**
737  * Enable pause frames
738  */
739 #define DPNI_LINK_OPT_PAUSE             0x0000000000000004ULL
740 /**
741  * Enable a-symmetric pause frames
742  */
743 #define DPNI_LINK_OPT_ASYM_PAUSE        0x0000000000000008ULL
744
745 /**
746  * struct dpni_link_state - Structure representing DPNI link state
747  * @rate: Rate
748  * @options: Mask of available options; use 'DPNI_LINK_OPT_<X>' values
749  * @up: Link state; '0' for down, '1' for up
750  */
751 struct dpni_link_state {
752         uint32_t        rate;
753         uint64_t        options;
754         int             up;
755 };
756
757 /**
758  * dpni_get_link_state() - Return the link state (either up or down)
759  * @mc_io:      Pointer to MC portal's I/O object
760  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
761  * @token:      Token of DPNI object
762  * @state:      Returned link state;
763  *
764  * Return:      '0' on Success; Error code otherwise.
765  */
766 int dpni_get_link_state(struct fsl_mc_io        *mc_io,
767                         uint32_t                cmd_flags,
768                         uint16_t                token,
769                         struct dpni_link_state  *state);
770
771 /**
772  * dpni_set_max_frame_length() - Set the maximum received frame length.
773  * @mc_io:      Pointer to MC portal's I/O object
774  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
775  * @token:      Token of DPNI object
776  * @max_frame_length:   Maximum received frame length (in
777  *                              bytes); frame is discarded if its
778  *                              length exceeds this value
779  *
780  * Return:      '0' on Success; Error code otherwise.
781  */
782 int dpni_set_max_frame_length(struct fsl_mc_io  *mc_io,
783                               uint32_t          cmd_flags,
784                               uint16_t          token,
785                               uint16_t          max_frame_length);
786
787 /**
788  * dpni_get_max_frame_length() - Get the maximum received frame length.
789  * @mc_io:      Pointer to MC portal's I/O object
790  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
791  * @token:      Token of DPNI object
792  * @max_frame_length:   Maximum received frame length (in
793  *                              bytes); frame is discarded if its
794  *                              length exceeds this value
795  *
796  * Return:      '0' on Success; Error code otherwise.
797  */
798 int dpni_get_max_frame_length(struct fsl_mc_io  *mc_io,
799                               uint32_t          cmd_flags,
800                               uint16_t          token,
801                               uint16_t          *max_frame_length);
802
803
804 /**
805  * dpni_set_unicast_promisc() - Enable/disable unicast promiscuous mode
806  * @mc_io:      Pointer to MC portal's I/O object
807  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
808  * @token:      Token of DPNI object
809  * @en:         Set to '1' to enable; '0' to disable
810  *
811  * Return:      '0' on Success; Error code otherwise.
812  */
813 int dpni_set_unicast_promisc(struct fsl_mc_io   *mc_io,
814                              uint32_t           cmd_flags,
815                              uint16_t           token,
816                              int                en);
817
818 /**
819  * dpni_get_unicast_promisc() - Get unicast promiscuous mode
820  * @mc_io:      Pointer to MC portal's I/O object
821  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
822  * @token:      Token of DPNI object
823  * @en:         Returns '1' if enabled; '0' otherwise
824  *
825  * Return:      '0' on Success; Error code otherwise.
826  */
827 int dpni_get_unicast_promisc(struct fsl_mc_io   *mc_io,
828                              uint32_t           cmd_flags,
829                              uint16_t           token,
830                              int                *en);
831
832 /**
833  * dpni_set_primary_mac_addr() - Set the primary MAC address
834  * @mc_io:      Pointer to MC portal's I/O object
835  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
836  * @token:      Token of DPNI object
837  * @mac_addr:   MAC address to set as primary address
838  *
839  * Return:      '0' on Success; Error code otherwise.
840  */
841 int dpni_set_primary_mac_addr(struct fsl_mc_io  *mc_io,
842                               uint32_t          cmd_flags,
843                               uint16_t          token,
844                               const uint8_t     mac_addr[6]);
845
846 /**
847  * dpni_get_primary_mac_addr() - Get the primary MAC address
848  * @mc_io:      Pointer to MC portal's I/O object
849  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
850  * @token:      Token of DPNI object
851  * @mac_addr:   Returned MAC address
852  *
853  * Return:      '0' on Success; Error code otherwise.
854  */
855 int dpni_get_primary_mac_addr(struct fsl_mc_io  *mc_io,
856                               uint32_t          cmd_flags,
857                               uint16_t          token,
858                               uint8_t           mac_addr[6]);
859
860
861 /**
862  * dpni_get_port_mac_addr() - Retrieve MAC address associated to the physical
863  *              port the DPNI is attached to
864  * @mc_io:      Pointer to MC portal's I/O object
865  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
866  * @token:      Token of DPNI object
867  * @mac_addr:   MAC address of the physical port, if any, otherwise 0
868  *
869  * The primary MAC address is not modified by this operation.
870  *
871  * Return:      '0' on Success; Error code otherwise.
872  */
873 int dpni_get_port_mac_addr(struct fsl_mc_io     *mc_io,
874                            uint32_t             cmd_flags,
875                            uint16_t             token,
876                            uint8_t              mac_addr[6]);
877
878 /**
879  * enum dpni_dist_mode - DPNI distribution mode
880  * @DPNI_DIST_MODE_NONE: No distribution
881  * @DPNI_DIST_MODE_HASH: Use hash distribution; only relevant if
882  *              the 'DPNI_OPT_DIST_HASH' option was set at DPNI creation
883  * @DPNI_DIST_MODE_FS:  Use explicit flow steering; only relevant if
884  *       the 'DPNI_OPT_DIST_FS' option was set at DPNI creation
885  */
886 enum dpni_dist_mode {
887         DPNI_DIST_MODE_NONE = 0,
888         DPNI_DIST_MODE_HASH = 1,
889         DPNI_DIST_MODE_FS = 2
890 };
891
892 /**
893  * enum dpni_fs_miss_action -   DPNI Flow Steering miss action
894  * @DPNI_FS_MISS_DROP: In case of no-match, drop the frame
895  * @DPNI_FS_MISS_EXPLICIT_FLOWID: In case of no-match, use explicit flow-id
896  * @DPNI_FS_MISS_HASH: In case of no-match, distribute using hash
897  */
898 enum dpni_fs_miss_action {
899         DPNI_FS_MISS_DROP = 0,
900         DPNI_FS_MISS_EXPLICIT_FLOWID = 1,
901         DPNI_FS_MISS_HASH = 2
902 };
903
904 /**
905  * struct dpni_fs_tbl_cfg - Flow Steering table configuration
906  * @miss_action: Miss action selection
907  * @default_flow_id: Used when 'miss_action = DPNI_FS_MISS_EXPLICIT_FLOWID'
908  */
909 struct dpni_fs_tbl_cfg {
910         enum dpni_fs_miss_action        miss_action;
911         uint16_t                        default_flow_id;
912 };
913
914 /**
915  * dpni_prepare_key_cfg() - function prepare extract parameters
916  * @cfg: defining a full Key Generation profile (rule)
917  * @key_cfg_buf: Zeroed 256 bytes of memory before mapping it to DMA
918  *
919  * This function has to be called before the following functions:
920  *      - dpni_set_rx_tc_dist()
921  *      - dpni_set_qos_table()
922  */
923 int dpni_prepare_key_cfg(const struct dpkg_profile_cfg  *cfg,
924                          uint8_t                        *key_cfg_buf);
925
926 /**
927  * struct dpni_rx_tc_dist_cfg - Rx traffic class distribution configuration
928  * @dist_size: Set the distribution size;
929  *      supported values: 1,2,3,4,6,7,8,12,14,16,24,28,32,48,56,64,96,
930  *      112,128,192,224,256,384,448,512,768,896,1024
931  * @dist_mode: Distribution mode
932  * @key_cfg_iova: I/O virtual address of 256 bytes DMA-able memory filled with
933  *              the extractions to be used for the distribution key by calling
934  *              dpni_prepare_key_cfg() relevant only when
935  *              'dist_mode != DPNI_DIST_MODE_NONE', otherwise it can be '0'
936  * @fs_cfg: Flow Steering table configuration; only relevant if
937  *              'dist_mode = DPNI_DIST_MODE_FS'
938  */
939 struct dpni_rx_tc_dist_cfg {
940         uint16_t                dist_size;
941         enum dpni_dist_mode     dist_mode;
942         uint64_t                key_cfg_iova;
943         struct dpni_fs_tbl_cfg  fs_cfg;
944 };
945
946 /**
947  * dpni_set_rx_tc_dist() - Set Rx traffic class distribution configuration
948  * @mc_io:      Pointer to MC portal's I/O object
949  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
950  * @token:      Token of DPNI object
951  * @tc_id:      Traffic class selection (0-7)
952  * @cfg:        Traffic class distribution configuration
953  *
954  * warning: if 'dist_mode != DPNI_DIST_MODE_NONE', call dpni_prepare_key_cfg()
955  *                      first to prepare the key_cfg_iova parameter
956  *
957  * Return:      '0' on Success; error code otherwise.
958  */
959 int dpni_set_rx_tc_dist(struct fsl_mc_io                        *mc_io,
960                         uint32_t                                cmd_flags,
961                         uint16_t                                token,
962                         uint8_t                                 tc_id,
963                         const struct dpni_rx_tc_dist_cfg        *cfg);
964
965 /**
966  * enum dpni_dest - DPNI destination types
967  * @DPNI_DEST_NONE: Unassigned destination; The queue is set in parked mode and
968  *              does not generate FQDAN notifications; user is expected to
969  *              dequeue from the queue based on polling or other user-defined
970  *              method
971  * @DPNI_DEST_DPIO: The queue is set in schedule mode and generates FQDAN
972  *              notifications to the specified DPIO; user is expected to dequeue
973  *              from the queue only after notification is received
974  * @DPNI_DEST_DPCON: The queue is set in schedule mode and does not generate
975  *              FQDAN notifications, but is connected to the specified DPCON
976  *              object; user is expected to dequeue from the DPCON channel
977  */
978 enum dpni_dest {
979         DPNI_DEST_NONE = 0,
980         DPNI_DEST_DPIO = 1,
981         DPNI_DEST_DPCON = 2
982 };
983
984
985 /**
986  * struct dpni_queue - Queue structure
987  * @user_context:       User data, presented to the user along with any frames
988  *                      from this queue. Not relevant for Tx queues.
989  */
990 struct dpni_queue {
991         /**
992          * struct destination - Destination structure
993          * @id: ID of the destination, only relevant if DEST_TYPE is > 0.
994          *                      Identifies either a DPIO or a DPCON object.
995          *                      Not relevant for Tx queues.
996          * @type:       May be one of the following:
997          *                      0 - No destination, queue can be manually
998          *                              queried, but will not push traffic or
999          *                              notifications to a DPIO;
1000          *                      1 - The destination is a DPIO. When traffic
1001          *                              becomes available in the queue a FQDAN
1002          *                              (FQ data available notification) will be
1003          *                              generated to selected DPIO;
1004          *                      2 - The destination is a DPCON. The queue is
1005          *                              associated with a DPCON object for the
1006          *                              purpose of scheduling between multiple
1007          *                              queues. The DPCON may be independently
1008          *                              configured to generate notifications.
1009          *                              Not relevant for Tx queues.
1010          * @hold_active: Hold active, maintains a queue scheduled for longer
1011          *              in a DPIO during dequeue to reduce spread of traffic.
1012          *              Only relevant if queues are
1013          *              not affined to a single DPIO.
1014          */
1015         struct {
1016                 uint16_t id;
1017                 enum dpni_dest type;
1018                 char hold_active;
1019                 uint8_t priority;
1020         } destination;
1021         uint64_t user_context;
1022         /**
1023          * struct flc - FD FLow Context structure
1024          * @value:              FLC value to set
1025          * @stash_control:      Boolean, indicates whether the 6 lowest
1026          *                      significant bits are used for stash control.
1027          */
1028         struct {
1029                 uint64_t value;
1030                 char stash_control;
1031         } flc;
1032 };
1033
1034 /**
1035  * struct dpni_queue_id - Queue identification, used for enqueue commands
1036  *                              or queue control
1037  * @fqid:       FQID used for enqueueing to and/or configuration of this
1038  *                      specific FQ
1039  * @qdbin:      Queueing bin, used to enqueue using QDID, DQBIN, QPRI.
1040  *                      Only relevant for Tx queues.
1041  */
1042 struct dpni_queue_id {
1043         uint32_t fqid;
1044         uint16_t qdbin;
1045 };
1046
1047 /**
1048  * enum dpni_confirmation_mode - Defines DPNI options supported for Tx
1049  * confirmation
1050  * @DPNI_CONF_AFFINE: For each Tx queue set associated with a sender there is
1051  * an affine Tx Confirmation queue
1052  * @DPNI_CONF_SINGLE: All Tx queues are associated with a single Tx
1053  * confirmation queue
1054  * @DPNI_CONF_DISABLE: Tx frames are not confirmed.  This must be associated
1055  * with proper FD set-up to have buffers release to a Buffer Pool, otherwise
1056  * buffers will be leaked
1057  */
1058 enum dpni_confirmation_mode {
1059         DPNI_CONF_AFFINE,
1060         DPNI_CONF_SINGLE,
1061         DPNI_CONF_DISABLE,
1062 };
1063
1064 /**
1065  * dpni_set_tx_confirmation_mode() - Tx confirmation mode
1066  * @mc_io:      Pointer to MC portal's I/O object
1067  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
1068  * @token:      Token of DPNI object
1069  * @mode:       Tx confirmation mode
1070  *
1071  * This function is useful only when 'DPNI_OPT_TX_CONF_DISABLED' is not
1072  * selected at DPNI creation.
1073  * Calling this function with 'mode' set to DPNI_CONF_DISABLE disables all
1074  * transmit confirmation (including the private confirmation queues), regardless
1075  * of previous settings; Note that in this case, Tx error frames are still
1076  * enqueued to the general transmit errors queue.
1077  * Calling this function with 'mode' set to DPNI_CONF_SINGLE switches all
1078  * Tx confirmations to a shared Tx conf queue.  The ID of the queue when
1079  * calling dpni_set/get_queue is -1.
1080  *
1081  * Return:      '0' on Success; Error code otherwise.
1082  */
1083 int dpni_set_tx_confirmation_mode(struct fsl_mc_io              *mc_io,
1084                                   uint32_t                      cmd_flags,
1085                                   uint16_t                      token,
1086                                   enum dpni_confirmation_mode   mode);
1087
1088 /**
1089  * dpni_get_api_version() - Get Data Path Network Interface API version
1090  * @mc_io:  Pointer to MC portal's I/O object
1091  * @cmd_flags:  Command flags; one or more of 'MC_CMD_FLAG_'
1092  * @major_ver:  Major version of data path network interface API
1093  * @minor_ver:  Minor version of data path network interface API
1094  *
1095  * Return:  '0' on Success; Error code otherwise.
1096  */
1097 int dpni_get_api_version(struct fsl_mc_io *mc_io,
1098                          uint32_t cmd_flags,
1099                          uint16_t *major_ver,
1100                          uint16_t *minor_ver);
1101
1102 /**
1103  * Set User Context
1104  */
1105 #define DPNI_QUEUE_OPT_USER_CTX         0x00000001
1106
1107 /**
1108  * Set queue destination configuration
1109  */
1110 #define DPNI_QUEUE_OPT_DEST             0x00000002
1111
1112 /**
1113  * Set FD[FLC] configuration for traffic on this queue.  Note that FLC values
1114  * set with dpni_add_fs_entry, if any, take precedence over values per queue.
1115  */
1116 #define DPNI_QUEUE_OPT_FLC              0x00000004
1117
1118 /**
1119  * Set the queue to hold active mode.  This prevents the queue from being
1120  * rescheduled between DPIOs while it carries traffic and is active on one
1121  * DPNI.  Can help reduce reordering when servicing one queue on multiple
1122  * CPUs, but the queue is also less likely to push data to multiple CPUs
1123  * especially when congested.
1124  */
1125 #define DPNI_QUEUE_OPT_HOLD_ACTIVE      0x00000008
1126
1127 /**
1128  * dpni_set_queue() - Set queue parameters
1129  * @mc_io:              Pointer to MC portal's I/O object
1130  * @cmd_flags:          Command flags; one or more of 'MC_CMD_FLAG_'
1131  * @token:              Token of DPNI object
1132  * @qtype:              Type of queue - all queue types are supported, although
1133  *                              the command is ignored for Tx
1134  * @tc:                 Traffic class, in range 0 to NUM_TCS - 1
1135  * @index:              Selects the specific queue out of the set
1136  *                              allocated for the same TC.Value must be in
1137  *                              range 0 to NUM_QUEUES - 1
1138  * @options:            A combination of DPNI_QUEUE_OPT_ values that control
1139  *                              what configuration options are set on the queue
1140  * @queue:              Queue configuration structure
1141  *
1142  * Return:  '0' on Success; Error code otherwise.
1143  */
1144 int dpni_set_queue(struct fsl_mc_io *mc_io,
1145                    uint32_t cmd_flags,
1146                    uint16_t token,
1147                    enum dpni_queue_type qtype,
1148                    uint8_t tc,
1149                    uint8_t index,
1150                    uint8_t options,
1151                    const struct dpni_queue *queue);
1152
1153 /**
1154  * dpni_get_queue() - Get queue parameters
1155  * @mc_io:              Pointer to MC portal's I/O object
1156  * @cmd_flags:          Command flags; one or more of 'MC_CMD_FLAG_'
1157  * @token:              Token of DPNI object
1158  * @qtype:              Type of queue - all queue types are supported
1159  * @tc:                 Traffic class, in range 0 to NUM_TCS - 1
1160  * @index:              Selects the specific queue out of the set allocated
1161  *                              for the same TC. Value must be in range 0 to
1162  *                              NUM_QUEUES - 1
1163  * @queue:              Queue configuration structure
1164  * @qid:                Queue identification
1165  *
1166  * This function returns current queue configuration which can be changed by
1167  * calling dpni_set_queue, and queue identification information.
1168  * Returned qid.fqid and/or qid.qdbin values can be used to:
1169  * - enqueue traffic for Tx queues,
1170  * - perform volatile dequeue for Rx and, if applicable, Tx confirmation
1171  *   clean-up,
1172  * - retrieve queue state.
1173  *
1174  * All these operations are supported through the DPIO run-time API.
1175  *
1176  * Return:  '0' on Success; Error code otherwise.
1177  */
1178 int dpni_get_queue(struct fsl_mc_io *mc_io,
1179                    uint32_t cmd_flags,
1180                    uint16_t token,
1181                    enum dpni_queue_type qtype,
1182                    uint8_t tc,
1183                    uint8_t index,
1184                    struct dpni_queue *queue,
1185                    struct dpni_queue_id *qid);
1186
1187 /**
1188  * dpni_get_statistics() - Get DPNI statistics
1189  * @mc_io:              Pointer to MC portal's I/O object
1190  * @cmd_flags:          Command flags; one or more of 'MC_CMD_FLAG_'
1191  * @token:              Token of DPNI object
1192  * @page:               Selects the statistics page to retrieve, see
1193  *                              DPNI_GET_STATISTICS output.
1194  *                              Pages are numbered 0 to 2.
1195  * @stat:               Structure containing the statistics
1196  *
1197  * Return:  '0' on Success; Error code otherwise.
1198  */
1199 int dpni_get_statistics(struct fsl_mc_io *mc_io,
1200                         uint32_t cmd_flags,
1201                         uint16_t token,
1202                         uint8_t page,
1203                         union dpni_statistics *stat);
1204
1205 /**
1206  * dpni_reset_statistics() - Clears DPNI statistics
1207  * @mc_io:              Pointer to MC portal's I/O object
1208  * @cmd_flags:          Command flags; one or more of 'MC_CMD_FLAG_'
1209  * @token:              Token of DPNI object
1210  *
1211  * Return:  '0' on Success; Error code otherwise.
1212  */
1213 int dpni_reset_statistics(struct fsl_mc_io *mc_io,
1214                           uint32_t cmd_flags,
1215                           uint16_t token);
1216
1217 #endif /* __FSL_DPNI_H */