1296177Sjhibbits/******************************************************************************
2296177Sjhibbits
3296177Sjhibbits � 1995-2003, 2004, 2005-2011 Freescale Semiconductor, Inc.
4296177Sjhibbits All rights reserved.
5296177Sjhibbits
6296177Sjhibbits This is proprietary source code of Freescale Semiconductor Inc.,
7296177Sjhibbits and its use is subject to the NetComm Device Drivers EULA.
8296177Sjhibbits The copyright notice above does not evidence any actual or intended
9296177Sjhibbits publication of such source code.
10296177Sjhibbits
11296177Sjhibbits ALTERNATIVELY, redistribution and use in source and binary forms, with
12296177Sjhibbits or without modification, are permitted provided that the following
13296177Sjhibbits conditions are met:
14296177Sjhibbits     * Redistributions of source code must retain the above copyright
15296177Sjhibbits       notice, this list of conditions and the following disclaimer.
16296177Sjhibbits     * Redistributions in binary form must reproduce the above copyright
17296177Sjhibbits       notice, this list of conditions and the following disclaimer in the
18296177Sjhibbits       documentation and/or other materials provided with the distribution.
19296177Sjhibbits     * Neither the name of Freescale Semiconductor nor the
20296177Sjhibbits       names of its contributors may be used to endorse or promote products
21296177Sjhibbits       derived from this software without specific prior written permission.
22296177Sjhibbits
23296177Sjhibbits THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24296177Sjhibbits EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25296177Sjhibbits WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26296177Sjhibbits DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27296177Sjhibbits DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28296177Sjhibbits (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29296177Sjhibbits LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30296177Sjhibbits ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31296177Sjhibbits (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32296177Sjhibbits SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33296177Sjhibbits *
34296177Sjhibbits
35296177Sjhibbits **************************************************************************/
36296177Sjhibbits/******************************************************************************
37296177Sjhibbits @File          qm_ext.h
38296177Sjhibbits
39296177Sjhibbits @Description   QM & Portal API
40296177Sjhibbits*//***************************************************************************/
41296177Sjhibbits#ifndef __QM_EXT_H
42296177Sjhibbits#define __QM_EXT_H
43296177Sjhibbits
44296177Sjhibbits#include "error_ext.h"
45296177Sjhibbits#include "std_ext.h"
46296177Sjhibbits#include "dpaa_ext.h"
47296177Sjhibbits#include "part_ext.h"
48296177Sjhibbits
49296177Sjhibbits
50296177Sjhibbits/**************************************************************************//**
51296177Sjhibbits @Group         QM_grp Queue Manager API
52296177Sjhibbits
53296177Sjhibbits @Description   QM API functions, definitions and enums.
54296177Sjhibbits
55296177Sjhibbits @{
56296177Sjhibbits*//***************************************************************************/
57296177Sjhibbits
58296177Sjhibbits/**************************************************************************//**
59296177Sjhibbits @Description   This callback type is used when receiving frame.
60296177Sjhibbits
61296177Sjhibbits                User provides this function. Driver invokes it.
62296177Sjhibbits
63296177Sjhibbits @Param[in]     h_App       A user argument to the callback
64296177Sjhibbits @Param[in]     h_QmFqr     A handle to an QM-FQR Module.
65296177Sjhibbits @Param[in]     fqidOffset  fqid offset from the FQR's fqid base.
66296177Sjhibbits @Param[in]     p_Frame     The Received Frame
67296177Sjhibbits
68296177Sjhibbits @Retval        e_RX_STORE_RESPONSE_CONTINUE - order the driver to continue Rx
69296177Sjhibbits                                               operation for all ready data.
70296177Sjhibbits @Retval        e_RX_STORE_RESPONSE_PAUSE    - order the driver to stop Rx operation.
71296177Sjhibbits
72296177Sjhibbits @Cautions      p_Frame is local parameter; i.e. users must NOT access or use
73296177Sjhibbits                this parameter in any means outside this callback context.
74296177Sjhibbits*//***************************************************************************/
75296177Sjhibbitstypedef e_RxStoreResponse (t_QmReceivedFrameCallback)(t_Handle h_App,
76296177Sjhibbits                                                      t_Handle h_QmFqr,
77296177Sjhibbits                                                      t_Handle h_QmPortal,
78296177Sjhibbits                                                      uint32_t fqidOffset,
79296177Sjhibbits                                                      t_DpaaFD *p_Frame);
80296177Sjhibbits
81296177Sjhibbits/**************************************************************************//**
82296177Sjhibbits @Description   This callback type is used when the FQR is completely was drained.
83296177Sjhibbits
84296177Sjhibbits                User provides this function. Driver invokes it.
85296177Sjhibbits
86296177Sjhibbits @Param[in]     h_App       A user argument to the callback
87296177Sjhibbits @Param[in]     h_QmFqr     A handle to an QM-FQR Module.
88296177Sjhibbits
89296177Sjhibbits @Retval        E_OK on success; Error code otherwise.
90296177Sjhibbits*//***************************************************************************/
91296177Sjhibbitstypedef t_Error (t_QmFqrDrainedCompletionCB)(t_Handle h_App,
92296177Sjhibbits                                             t_Handle h_QmFqr);
93296177Sjhibbits
94296177Sjhibbits/**************************************************************************//**
95296177Sjhibbits @Description   QM Rejection code enum
96296177Sjhibbits*//***************************************************************************/
97296177Sjhibbitstypedef enum e_QmRejectionCode
98296177Sjhibbits{
99296177Sjhibbits    e_QM_RC_NONE,
100296177Sjhibbits
101296177Sjhibbits    e_QM_RC_CG_TAILDROP,    /**< This frames was rejected due to congestion
102296177Sjhibbits                                     group taildrop situation */
103296177Sjhibbits    e_QM_RC_CG_WRED,            /**< This frames was rejected due to congestion
104296177Sjhibbits                                     group WRED situation */
105296177Sjhibbits    e_QM_RC_FQ_TAILDROP         /**< This frames was rejected due to FQID TD
106296177Sjhibbits                                     situation */
107296177Sjhibbits/*  e_QM_RC_ERROR
108296177Sjhibbits    e_QM_RC_ORPWINDOW_EARLY
109296177Sjhibbits    e_QM_RC_ORPWINDOW_LATE
110296177Sjhibbits    e_QM_RC_ORPWINDOW_RETIRED */
111296177Sjhibbits} e_QmRejectionCode;
112296177Sjhibbits
113296177Sjhibbits/**************************************************************************//**
114296177Sjhibbits @Description   QM Rejected frame information
115296177Sjhibbits*//***************************************************************************/
116296177Sjhibbitstypedef struct t_QmRejectedFrameInfo
117296177Sjhibbits{
118296177Sjhibbits    e_QmRejectionCode    rejectionCode; /**< Rejection code */
119296177Sjhibbits    union
120296177Sjhibbits    {
121296177Sjhibbits        struct
122296177Sjhibbits        {
123296177Sjhibbits            uint8_t cgId;               /**< congestion group id*/
124296177Sjhibbits        } cg;                           /**< rejection parameters when rejectionCode =
125296177Sjhibbits                                             e_QM_RC_CG_TAILDROP or e_QM_RC_CG_WRED. */
126296177Sjhibbits    };
127296177Sjhibbits} t_QmRejectedFrameInfo;
128296177Sjhibbits
129296177Sjhibbits/**************************************************************************//**
130296177Sjhibbits @Description   This callback type is used when receiving rejected frames.
131296177Sjhibbits
132296177Sjhibbits                User provides this function. Driver invokes it.
133296177Sjhibbits
134296177Sjhibbits @Param[in]     h_App                   A user argument to the callback
135296177Sjhibbits @Param[in]     h_QmFqr                 A handle to an QM-FQR Module.
136296177Sjhibbits @Param[in]     fqidOffset              fqid offset from the FQR's fqid base.
137296177Sjhibbits @Param[in]     p_Frame                 The Rejected Frame
138296177Sjhibbits @Param[in]     p_QmRejectedFrameInfo   Rejected Frame information
139296177Sjhibbits
140296177Sjhibbits @Retval        e_RX_STORE_RESPONSE_CONTINUE - order the driver to continue Rx
141296177Sjhibbits                                               operation for all ready data.
142296177Sjhibbits @Retval        e_RX_STORE_RESPONSE_PAUSE    - order the driver to stop Rx operation.
143296177Sjhibbits
144296177Sjhibbits @Cautions      p_Frame is local parameter; i.e. users must NOT access or use
145296177Sjhibbits                this parameter in any means outside this callback context.
146296177Sjhibbits*//***************************************************************************/
147296177Sjhibbitstypedef e_RxStoreResponse (t_QmRejectedFrameCallback)(t_Handle h_App,
148296177Sjhibbits                                                      t_Handle h_QmFqr,
149296177Sjhibbits                                                      t_Handle h_QmPortal,
150296177Sjhibbits                                                      uint32_t fqidOffset,
151296177Sjhibbits                                                      t_DpaaFD *p_Frame,
152296177Sjhibbits                                                      t_QmRejectedFrameInfo *p_QmRejectedFrameInfo);
153296177Sjhibbits
154296177Sjhibbits
155296177Sjhibbits
156296177Sjhibbits/**************************************************************************//**
157296177Sjhibbits @Group         QM_lib_grp QM common API
158296177Sjhibbits
159296177Sjhibbits @Description   QM common API functions, definitions and enums.
160296177Sjhibbits
161296177Sjhibbits @{
162296177Sjhibbits*//***************************************************************************/
163296177Sjhibbits
164296177Sjhibbits/**************************************************************************//**
165296177Sjhibbits @Description   QM Exceptions
166296177Sjhibbits*//***************************************************************************/
167296177Sjhibbitstypedef enum e_QmExceptions {
168296177Sjhibbits    e_QM_EX_CORENET_INITIATOR_DATA = 0,         /**< Initiator Data Error */
169296177Sjhibbits    e_QM_EX_CORENET_TARGET_DATA,                /**< CoreNet Target Data Error */
170296177Sjhibbits    e_QM_EX_CORENET_INVALID_TARGET_TRANSACTION, /**< Invalid Target Transaction */
171296177Sjhibbits    e_QM_EX_PFDR_THRESHOLD,                     /**< PFDR Low Watermark Interrupt */
172296177Sjhibbits    e_QM_EX_PFDR_ENQUEUE_BLOCKED,               /**< PFDR Enqueues Blocked Interrupt */
173296177Sjhibbits    e_QM_EX_SINGLE_ECC,                         /**< Single Bit ECC Error Interrupt */
174296177Sjhibbits    e_QM_EX_MULTI_ECC,                          /**< Multi Bit ECC Error Interrupt */
175296177Sjhibbits    e_QM_EX_INVALID_COMMAND,                    /**< Invalid Command Verb Interrupt */
176296177Sjhibbits    e_QM_EX_DEQUEUE_DCP,                        /**< Invalid Dequeue Direct Connect Portal Interrupt */
177296177Sjhibbits    e_QM_EX_DEQUEUE_FQ,                         /**< Invalid Dequeue FQ Interrupt */
178296177Sjhibbits    e_QM_EX_DEQUEUE_SOURCE,                     /**< Invalid Dequeue Source Interrupt */
179296177Sjhibbits    e_QM_EX_DEQUEUE_QUEUE,                      /**< Invalid Dequeue Queue Interrupt */
180296177Sjhibbits    e_QM_EX_ENQUEUE_OVERFLOW,                   /**< Invalid Enqueue Overflow Interrupt */
181296177Sjhibbits    e_QM_EX_ENQUEUE_STATE,                      /**< Invalid Enqueue State Interrupt */
182296177Sjhibbits    e_QM_EX_ENQUEUE_CHANNEL,                    /**< Invalid Enqueue Channel Interrupt */
183296177Sjhibbits    e_QM_EX_ENQUEUE_QUEUE,                      /**< Invalid Enqueue Queue Interrupt */
184296177Sjhibbits    e_QM_EX_CG_STATE_CHANGE                     /**< CG change state notification */
185296177Sjhibbits} e_QmExceptions;
186296177Sjhibbits
187296177Sjhibbits/**************************************************************************//**
188296177Sjhibbits @Group         QM_init_grp QM (common) Initialization Unit
189296177Sjhibbits
190296177Sjhibbits @Description   QM (common) Initialization Unit
191296177Sjhibbits
192296177Sjhibbits @{
193296177Sjhibbits*//***************************************************************************/
194296177Sjhibbits
195296177Sjhibbits/**************************************************************************//**
196296177Sjhibbits @Function      t_QmExceptionsCallback
197296177Sjhibbits
198296177Sjhibbits @Description   Exceptions user callback routine, will be called upon an
199296177Sjhibbits                exception passing the exception identification.
200296177Sjhibbits
201296177Sjhibbits @Param[in]     h_App      - User's application descriptor.
202296177Sjhibbits @Param[in]     exception  - The exception.
203296177Sjhibbits*//***************************************************************************/
204296177Sjhibbitstypedef void (t_QmExceptionsCallback) ( t_Handle              h_App,
205296177Sjhibbits                                        e_QmExceptions        exception);
206296177Sjhibbits
207296177Sjhibbits/**************************************************************************//**
208296177Sjhibbits @Description    Frame's Type to poll
209296177Sjhibbits*//***************************************************************************/
210296177Sjhibbitstypedef enum e_QmPortalPollSource {
211296177Sjhibbits    e_QM_PORTAL_POLL_SOURCE_DATA_FRAMES = 0,    /**< Poll only data frames */
212296177Sjhibbits    e_QM_PORTAL_POLL_SOURCE_CONTROL_FRAMES,     /**< Poll only control frames */
213296177Sjhibbits    e_QM_PORTAL_POLL_SOURCE_BOTH                /**< Poll both */
214296177Sjhibbits} e_QmPortalPollSource;
215296177Sjhibbits
216296177Sjhibbits/**************************************************************************//**
217296177Sjhibbits @Description   structure representing QM contextA of FQ initialization parameters
218296177Sjhibbits                Note that this is only "space-holder" for the Context-A. The "real"
219296177Sjhibbits                Context-A is described in each specific driver (E.g. FM driver
220296177Sjhibbits                has its own Context-A API).
221296177Sjhibbits*//***************************************************************************/
222296177Sjhibbitstypedef struct {
223296177Sjhibbits    uint32_t    res[2];     /**< reserved size for context-a */
224296177Sjhibbits} t_QmContextA;
225296177Sjhibbits
226296177Sjhibbits/**************************************************************************//**
227296177Sjhibbits @Description   structure representing QM contextB of FQ initialization parameters
228296177Sjhibbits                Note that this is only "space-holder" for the Context-B. The "real"
229296177Sjhibbits                Context-B is described in each specific driver (E.g. FM driver
230296177Sjhibbits                has its own Context-B API).
231296177Sjhibbits*//***************************************************************************/
232296177Sjhibbitstypedef  uint32_t   t_QmContextB;
233296177Sjhibbits
234296177Sjhibbits/**************************************************************************//**
235296177Sjhibbits @Description   structure representing QM initialization parameters
236296177Sjhibbits*//***************************************************************************/
237296177Sjhibbitstypedef struct {
238296177Sjhibbits    uint8_t                 guestId;                /**< QM Partition Id */
239296177Sjhibbits
240296177Sjhibbits    uintptr_t               baseAddress;            /**< Qm base address (virtual)
241296177Sjhibbits                                                         NOTE: this parameter relevant only for BM in master mode ('guestId'=NCSW_MASTER_ID). */
242296177Sjhibbits    uintptr_t               swPortalsBaseAddress;   /**< QM Software Portals Base Address (virtual) */
243296177Sjhibbits    uint16_t                liodn;                  /**< This value is attached to every transaction initiated by QMan when accessing its private data structures */
244296177Sjhibbits    uint32_t                totalNumOfFqids;        /**< Total number of frame-queue-ids in the system */
245296177Sjhibbits    uint32_t                fqdMemPartitionId;      /**< FQD's mem partition id;
246296177Sjhibbits                                                         NOTE: The memory partition must be non-cacheable and no-coherent area. */
247296177Sjhibbits    uint32_t                pfdrMemPartitionId;     /**< PFDR's mem partition id;
248296177Sjhibbits                                                         NOTE: The memory partition must be non-cacheable and no-coherent area. */
249296177Sjhibbits    t_QmExceptionsCallback  *f_Exception;           /**< An application callback routine to handle exceptions.*/
250296177Sjhibbits    t_Handle                h_App;                  /**< A handle to an application layer object; This handle will
251296177Sjhibbits                                                         be passed by the driver upon calling the above callbacks */
252296177Sjhibbits    int                     errIrq;                 /**< error interrupt line; NO_IRQ if interrupts not used */
253296177Sjhibbits    uint32_t                partFqidBase;           /**< The first frame-queue-id dedicated to this partition.
254296177Sjhibbits                                                         NOTE: this parameter relevant only when working with multiple partitions. */
255296177Sjhibbits    uint32_t                partNumOfFqids;         /**< Number of frame-queue-ids dedicated to this partition.
256296177Sjhibbits                                                         NOTE: this parameter relevant only when working with multiple partitions. */
257296177Sjhibbits    uint16_t                partCgsBase;            /**< The first cgr dedicated to this partition.
258296177Sjhibbits                                                         NOTE: this parameter relevant only when working with multiple partitions. */
259296177Sjhibbits    uint16_t                partNumOfCgs;           /**< Number of cgr's dedicated to this partition.
260296177Sjhibbits                                                         NOTE: this parameter relevant only when working with multiple partitions. */
261296177Sjhibbits} t_QmParam;
262296177Sjhibbits
263296177Sjhibbits
264296177Sjhibbits/**************************************************************************//**
265296177Sjhibbits @Function      QM_Config
266296177Sjhibbits
267296177Sjhibbits @Description   Creates descriptor for the QM module.
268296177Sjhibbits
269296177Sjhibbits                The routine returns a handle (descriptor) to the QM object.
270296177Sjhibbits                This descriptor must be passed as first parameter to all other
271296177Sjhibbits                QM function calls.
272296177Sjhibbits
273296177Sjhibbits                No actual initialization or configuration of QM hardware is
274296177Sjhibbits                done by this routine.
275296177Sjhibbits
276296177Sjhibbits @Param[in]     p_QmParam   - Pointer to data structure of parameters
277296177Sjhibbits
278296177Sjhibbits @Retval        Handle to the QM object, or NULL for Failure.
279296177Sjhibbits*//***************************************************************************/
280296177Sjhibbitst_Handle QM_Config(t_QmParam *p_QmParam);
281296177Sjhibbits
282296177Sjhibbits/**************************************************************************//**
283296177Sjhibbits @Function      QM_Init
284296177Sjhibbits
285296177Sjhibbits @Description   Initializes the QM module
286296177Sjhibbits
287296177Sjhibbits @Param[in]     h_Qm - A handle to the QM module
288296177Sjhibbits
289296177Sjhibbits @Return        E_OK on success; Error code otherwise.
290296177Sjhibbits*//***************************************************************************/
291296177Sjhibbitst_Error QM_Init(t_Handle h_Qm);
292296177Sjhibbits
293296177Sjhibbits/**************************************************************************//**
294296177Sjhibbits @Function      QM_Free
295296177Sjhibbits
296296177Sjhibbits @Description   Frees all resources that were assigned to the QM module.
297296177Sjhibbits
298296177Sjhibbits                Calling this routine invalidates the descriptor.
299296177Sjhibbits
300296177Sjhibbits @Param[in]     h_Qm - A handle to the QM module
301296177Sjhibbits
302296177Sjhibbits @Return        E_OK on success; Error code otherwise.
303296177Sjhibbits*//***************************************************************************/
304296177Sjhibbitst_Error QM_Free(t_Handle h_Qm);
305296177Sjhibbits
306296177Sjhibbits
307296177Sjhibbits/**************************************************************************//**
308296177Sjhibbits @Group         QM_advanced_init_grp    QM (common) Advanced Configuration Unit
309296177Sjhibbits
310296177Sjhibbits @Description   Configuration functions used to change default values.
311296177Sjhibbits
312296177Sjhibbits @{
313296177Sjhibbits*//***************************************************************************/
314296177Sjhibbits
315296177Sjhibbits/**************************************************************************//**
316296177Sjhibbits @Description   structure for defining DC portal ERN destination
317296177Sjhibbits*//***************************************************************************/
318296177Sjhibbitstypedef struct t_QmDcPortalParams {
319296177Sjhibbits    bool            sendToSw;
320296177Sjhibbits    e_DpaaSwPortal  swPortalId;
321296177Sjhibbits} t_QmDcPortalParams;
322296177Sjhibbits
323296177Sjhibbits
324296177Sjhibbits/**************************************************************************//**
325296177Sjhibbits @Function      QM_ConfigRTFramesDepth
326296177Sjhibbits
327296177Sjhibbits @Description   Change the run-time frames depth (i.e. the maximum total number
328296177Sjhibbits                of frames that may be inside QM at a certain time) from its default
329296177Sjhibbits                configuration [30000].
330296177Sjhibbits
331296177Sjhibbits @Param[in]     h_Qm            - A handle to the QM module
332296177Sjhibbits @Param[in]     rtFramesDepth   - run-time max num of frames.
333296177Sjhibbits
334296177Sjhibbits @Return        E_OK on success; Error code otherwise.
335296177Sjhibbits
336296177Sjhibbits @Cautions      Allowed only following QM_Config() and before QM_Init().
337296177Sjhibbits*//***************************************************************************/
338296177Sjhibbitst_Error QM_ConfigRTFramesDepth(t_Handle h_Qm, uint32_t rtFramesDepth);
339296177Sjhibbits
340296177Sjhibbits/**************************************************************************//**
341296177Sjhibbits @Function      QM_ConfigPfdrThreshold
342296177Sjhibbits
343296177Sjhibbits @Description   Change the pfdr threshold from its default
344296177Sjhibbits                configuration [0].
345296177Sjhibbits                An interrupt if enables is asserted when the number of PFDRs is below this threshold.
346296177Sjhibbits
347296177Sjhibbits @Param[in]     h_Qm            - A handle to the QM module
348296177Sjhibbits @Param[in]     threshold       - threshold value.
349296177Sjhibbits
350296177Sjhibbits @Return        E_OK on success; Error code otherwise.
351296177Sjhibbits
352296177Sjhibbits @Cautions      Allowed only following QM_Config() and before QM_Init().
353296177Sjhibbits*//***************************************************************************/
354296177Sjhibbitst_Error QM_ConfigPfdrThreshold(t_Handle h_Qm, uint32_t threshold);
355296177Sjhibbits
356296177Sjhibbits/**************************************************************************//**
357296177Sjhibbits @Function      QM_ConfigSfdrReservationThreshold
358296177Sjhibbits
359296177Sjhibbits @Description   Change the sfdr threshold from its default
360296177Sjhibbits                configuration [0].
361296177Sjhibbits
362296177Sjhibbits @Param[in]     h_Qm            - A handle to the QM module
363296177Sjhibbits @Param[in]     threshold       - threshold value.
364296177Sjhibbits
365296177Sjhibbits @Return        E_OK on success; Error code otherwise.
366296177Sjhibbits
367296177Sjhibbits @Cautions      Allowed only following QM_Config() and before QM_Init().
368296177Sjhibbits*//***************************************************************************/
369296177Sjhibbitst_Error QM_ConfigSfdrReservationThreshold(t_Handle h_Qm, uint32_t threshold);
370296177Sjhibbits
371296177Sjhibbits/**************************************************************************//**
372296177Sjhibbits @Function      QM_ConfigErrorRejectionNotificationDest
373296177Sjhibbits
374296177Sjhibbits @Description   Change the destination of rejected frames for DC portals.
375296177Sjhibbits                By default, depending on chip, some DC portals are set to reject
376296177Sjhibbits                frames to HW and some to SW.
377296177Sjhibbits
378296177Sjhibbits @Param[in]     h_Qm            - A handle to the QM module
379296177Sjhibbits @Param[in]     id              - DC Portal id.
380296177Sjhibbits @Param[in]     p_Params        - Destination parameters.
381296177Sjhibbits
382296177Sjhibbits @Return        E_OK on success; Error code otherwise.
383296177Sjhibbits
384296177Sjhibbits @Cautions      Allowed only following QM_Config() and before QM_Init().
385296177Sjhibbits*//***************************************************************************/
386296177Sjhibbitst_Error QM_ConfigErrorRejectionNotificationDest(t_Handle h_Qm, e_DpaaDcPortal id, t_QmDcPortalParams *p_Params);
387296177Sjhibbits
388296177Sjhibbits/** @} */ /* end of QM_advanced_init_grp group */
389296177Sjhibbits/** @} */ /* end of QM_init_grp group */
390296177Sjhibbits
391296177Sjhibbits
392296177Sjhibbits/**************************************************************************//**
393296177Sjhibbits @Group         QM_runtime_control_grp QM (common) Runtime Control Unit
394296177Sjhibbits
395296177Sjhibbits @Description   QM (common) Runtime control unit API functions, definitions and enums.
396296177Sjhibbits
397296177Sjhibbits @{
398296177Sjhibbits*//***************************************************************************/
399296177Sjhibbits
400296177Sjhibbits/**************************************************************************//**
401296177Sjhibbits @Description   enum for defining QM counters
402296177Sjhibbits*//***************************************************************************/
403296177Sjhibbitstypedef enum e_QmCounters {
404296177Sjhibbits    e_QM_COUNTERS_SFDR_IN_USE = 0,          /**< Total Single Frame Descriptor Record (SFDR) currently in use */
405296177Sjhibbits    e_QM_COUNTERS_PFDR_IN_USE,              /**< Total Packed Frame Descriptor Record (PFDR) currently in use */
406296177Sjhibbits    e_QM_COUNTERS_PFDR_FREE_POOL            /**< Total Packed Frame Descriptor Record (PFDR) Free Pool Count in external memory */
407296177Sjhibbits} e_QmCounters;
408296177Sjhibbits
409296177Sjhibbits/**************************************************************************//**
410296177Sjhibbits @Description   structure for returning revision information
411296177Sjhibbits*//***************************************************************************/
412296177Sjhibbitstypedef struct t_QmRevisionInfo {
413296177Sjhibbits    uint8_t         majorRev;               /**< Major revision */
414296177Sjhibbits    uint8_t         minorRev;               /**< Minor revision */
415296177Sjhibbits} t_QmRevisionInfo;
416296177Sjhibbits
417296177Sjhibbits/**************************************************************************//**
418296177Sjhibbits @Description   structure representing QM FQ-Range reservation parameters
419296177Sjhibbits*//***************************************************************************/
420296177Sjhibbitstypedef struct t_QmRsrvFqrParams {
421296177Sjhibbits    bool                useForce;       /**< TRUE - force reservation of specific fqids;
422296177Sjhibbits                                             FALSE - reserve several fqids */
423296177Sjhibbits    uint32_t            numOfFqids;     /**< number of fqids to be reserved. */
424296177Sjhibbits    union{
425296177Sjhibbits        struct {
426296177Sjhibbits            uint32_t    align;          /**< alignment. will be used if useForce=FALSE */
427296177Sjhibbits        } nonFrcQs;
428296177Sjhibbits        struct {
429296177Sjhibbits            uint32_t    fqid;           /**< the fqid base of the forced fqids. will be used if useForce=TRUE */
430296177Sjhibbits        } frcQ;
431296177Sjhibbits    } qs;
432296177Sjhibbits} t_QmRsrvFqrParams;
433296177Sjhibbits
434296177Sjhibbits/**************************************************************************//**
435296177Sjhibbits @Description   structure representing QM Error information
436296177Sjhibbits*//***************************************************************************/
437296177Sjhibbitstypedef struct t_QmErrorInfo {
438296177Sjhibbits    bool                portalValid;
439296177Sjhibbits    bool                hwPortal;
440296177Sjhibbits    e_DpaaSwPortal      swPortalId;         /**< Sw Portal id */
441296177Sjhibbits    e_DpaaDcPortal      dcpId;              /**< Dcp (hw Portal) id */
442296177Sjhibbits    bool                fqidValid;
443296177Sjhibbits    uint32_t            fqid;
444296177Sjhibbits} t_QmErrorInfo;
445296177Sjhibbits
446296177Sjhibbits
447296177Sjhibbits/**************************************************************************//**
448296177Sjhibbits @Function      QM_ReserveQueues
449296177Sjhibbits
450296177Sjhibbits @Description   Request to Reserved queues for future use.
451296177Sjhibbits
452296177Sjhibbits @Param[in]     h_Qm            - A handle to the QM Module.
453296177Sjhibbits @Param[in]     p_QmFqrParams   - A structure of parameters for defining the
454296177Sjhibbits                                  desired queues parameters.
455296177Sjhibbits @Param[out]    p_BaseFqid      - base-fqid on success; '0' code otherwise.
456296177Sjhibbits
457296177Sjhibbits @Return        E_OK on success;
458296177Sjhibbits
459296177Sjhibbits @Cautions      Allowed only after QM_Init().
460296177Sjhibbits*//***************************************************************************/
461296177Sjhibbitst_Error QM_ReserveQueues(t_Handle h_Qm, t_QmRsrvFqrParams *p_QmFqrParams, uint32_t  *p_BaseFqid);
462296177Sjhibbits
463296177Sjhibbits#if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))
464296177Sjhibbits/**************************************************************************//**
465296177Sjhibbits @Function      QM_DumpRegs
466296177Sjhibbits
467296177Sjhibbits @Description   Dumps all QM registers
468296177Sjhibbits
469296177Sjhibbits @Param[in]     h_Qm        - A handle to the QM Module.
470296177Sjhibbits
471296177Sjhibbits @Return        E_OK on success;
472296177Sjhibbits
473296177Sjhibbits @Cautions      Allowed only after QM_Init().
474296177Sjhibbits*//***************************************************************************/
475296177Sjhibbitst_Error QM_DumpRegs(t_Handle h_Qm);
476296177Sjhibbits#endif /* (defined(DEBUG_ERRORS) && ... */
477296177Sjhibbits
478296177Sjhibbits/**************************************************************************//**
479296177Sjhibbits @Function      QM_SetException
480296177Sjhibbits
481296177Sjhibbits @Description   Calling this routine enables/disables the specified exception.
482296177Sjhibbits
483296177Sjhibbits @Param[in]     h_Qm        - A handle to the QM Module.
484296177Sjhibbits @Param[in]     exception   - The exception to be selected.
485296177Sjhibbits @Param[in]     enable      - TRUE to enable interrupt, FALSE to mask it.
486296177Sjhibbits
487296177Sjhibbits @Return        E_OK on success; Error code otherwise.
488296177Sjhibbits
489296177Sjhibbits @Cautions      Allowed only following QM_Init().
490296177Sjhibbits                This routine should NOT be called from guest-partition
491296177Sjhibbits                (i.e. guestId != NCSW_MASTER_ID)
492296177Sjhibbits*//***************************************************************************/
493296177Sjhibbitst_Error QM_SetException(t_Handle h_Qm, e_QmExceptions exception, bool enable);
494296177Sjhibbits
495296177Sjhibbits/**************************************************************************//**
496296177Sjhibbits @Function      QM_ErrorIsr
497296177Sjhibbits
498296177Sjhibbits @Description   QM interrupt-service-routine for errors.
499296177Sjhibbits
500296177Sjhibbits @Param[in]     h_Qm            - A handle to the QM module
501296177Sjhibbits
502296177Sjhibbits @Cautions      Allowed only following QM_Init().
503296177Sjhibbits                This routine should NOT be called from guest-partition
504296177Sjhibbits                (i.e. guestId != NCSW_MASTER_ID)
505296177Sjhibbits*//***************************************************************************/
506296177Sjhibbitsvoid    QM_ErrorIsr(t_Handle h_Qm);
507296177Sjhibbits
508296177Sjhibbits/**************************************************************************//**
509296177Sjhibbits @Function      QM_GetErrorInformation
510296177Sjhibbits
511296177Sjhibbits @Description   Reads the last error information.
512296177Sjhibbits
513296177Sjhibbits @Param[in]     h_Qm        - A handle to the QM Module.
514296177Sjhibbits @Param[out]    p_errInfo   - the information will be loaded to this struct.
515296177Sjhibbits
516296177Sjhibbits @Return        E_OK on success; Error code otherwise.
517296177Sjhibbits
518296177Sjhibbits @Cautions      Allowed only following QM_Init().
519296177Sjhibbits                This routine should NOT be called from guest-partition
520296177Sjhibbits                (i.e. guestId != NCSW_MASTER_ID)
521296177Sjhibbits*//***************************************************************************/
522296177Sjhibbitst_Error QM_GetErrorInformation(t_Handle h_Qm, t_QmErrorInfo *p_errInfo);
523296177Sjhibbits
524296177Sjhibbits/**************************************************************************//**
525296177Sjhibbits @Function      QM_GetCounter
526296177Sjhibbits
527296177Sjhibbits @Description   Reads one of the QM counters.
528296177Sjhibbits
529296177Sjhibbits @Param[in]     h_Qm        - A handle to the QM Module.
530296177Sjhibbits @Param[in]     counter     - The requested counter.
531296177Sjhibbits
532296177Sjhibbits @Return        Counter's current value.
533296177Sjhibbits
534296177Sjhibbits @Cautions      Allowed only following QM_Init().
535296177Sjhibbits*//***************************************************************************/
536296177Sjhibbitsuint32_t    QM_GetCounter(t_Handle h_Qm, e_QmCounters counter);
537296177Sjhibbits
538296177Sjhibbits/**************************************************************************//**
539296177Sjhibbits @Function      QM_GetRevision
540296177Sjhibbits
541296177Sjhibbits @Description   Returns the QM revision
542296177Sjhibbits
543296177Sjhibbits @Param[in]     h_Qm                A handle to a QM Module.
544296177Sjhibbits @Param[out]    p_QmRevisionInfo    A structure of revision information parameters.
545296177Sjhibbits
546296177Sjhibbits @Return        None.
547296177Sjhibbits
548296177Sjhibbits @Cautions      Allowed only following QM_Init().
549296177Sjhibbits*//***************************************************************************/
550296177Sjhibbitst_Error QM_GetRevision(t_Handle h_Qm, t_QmRevisionInfo *p_QmRevisionInfo);
551296177Sjhibbits
552296177Sjhibbits/** @} */ /* end of QM_runtime_control_grp group */
553296177Sjhibbits
554296177Sjhibbits
555296177Sjhibbits/**************************************************************************//**
556296177Sjhibbits @Group         QM_runtime_data_grp QM (common) Runtime Data Unit
557296177Sjhibbits
558296177Sjhibbits @Description   QM (common) Runtime data unit API functions, definitions and enums.
559296177Sjhibbits
560296177Sjhibbits @{
561296177Sjhibbits*//***************************************************************************/
562296177Sjhibbits
563296177Sjhibbits/**************************************************************************//**
564296177Sjhibbits @Function      QM_Poll
565296177Sjhibbits
566296177Sjhibbits @Description   Poll frames from QM.
567296177Sjhibbits
568296177Sjhibbits @Param[in]     h_Qm            - A handle to the QM module
569296177Sjhibbits @Param[in]     source          - The selected frames type to poll
570296177Sjhibbits
571296177Sjhibbits @Return        E_OK on success; Error code otherwise.
572296177Sjhibbits
573296177Sjhibbits @Cautions      Allowed only following QM_Init().
574296177Sjhibbits*//***************************************************************************/
575296177Sjhibbitst_Error QM_Poll(t_Handle h_Qm, e_QmPortalPollSource source);
576296177Sjhibbits
577296177Sjhibbits/** @} */ /* end of QM_runtime_data_grp group */
578296177Sjhibbits/** @} */ /* end of QM_lib_grp group */
579296177Sjhibbits
580296177Sjhibbits
581296177Sjhibbits/**************************************************************************//**
582296177Sjhibbits @Group         QM_portal_grp QM-Portal API
583296177Sjhibbits
584296177Sjhibbits @Description   QM common API functions, definitions and enums.
585296177Sjhibbits
586296177Sjhibbits @{
587296177Sjhibbits*//***************************************************************************/
588296177Sjhibbits
589296177Sjhibbits/**************************************************************************//**
590296177Sjhibbits @Group         QM_portal_init_grp QM-Portal Initialization Unit
591296177Sjhibbits
592296177Sjhibbits @Description   QM-Portal Initialization Unit
593296177Sjhibbits
594296177Sjhibbits @{
595296177Sjhibbits*//***************************************************************************/
596296177Sjhibbits
597296177Sjhibbits/**************************************************************************//**
598296177Sjhibbits @Description   structure representing QM-Portal Stash parameters
599296177Sjhibbits*//***************************************************************************/
600296177Sjhibbitstypedef struct {
601296177Sjhibbits    uint8_t                         stashDestQueue;         /**< This value is used to direct all stashing transactions initiated on behalf of this software portal
602296177Sjhibbits                                                                 to the specific Stashing Request Queues (SRQ) */
603296177Sjhibbits    uint8_t                         eqcr;                   /**< If 0, disabled. If 1, for every EQCR entry consumed by QMan a new stash transaction is performed.
604296177Sjhibbits                                                                 If 2-7, after 2-7 EQCR entries being consumed by QMAN a new stash transaction is performed. */
605296177Sjhibbits    bool                            eqcrHighPri;            /**< EQCR entry stash transactions for this software portal will be signaled with higher priority. */
606296177Sjhibbits    bool                            dqrr;                   /**< DQRR entry stash enable/disable */
607296177Sjhibbits    uint16_t                        dqrrLiodn;              /**< This value is attached to every transaction initiated by QMan when performing DQRR entry or EQCR_CI stashing
608296177Sjhibbits                                                                 on behalf of this software portal */
609296177Sjhibbits    bool                            dqrrHighPri;            /**< DQRR entry stash transactions for this software portal will be signaled with higher priority. */
610296177Sjhibbits    bool                            fdFq;                   /**< Dequeued Frame Data, Annotation, and FQ Context Stashing enable/disable */
611296177Sjhibbits    uint16_t                        fdFqLiodn;              /**< This value is attached to every transaction initiated by QMan when performing dequeued frame data and
612296177Sjhibbits                                                                 annotation stashing, or FQ context stashing on behalf of this software portal */
613296177Sjhibbits    bool                            fdFqHighPri;            /**< Dequeued frame data, annotation, and FQ context stash transactions for this software portal will be signaled
614296177Sjhibbits                                                                 with higher priority. */
615296177Sjhibbits    bool                            fdFqDrop;               /**< If True, Dequeued frame data, annotation, and FQ context stash transactions for this software portal will be dropped
616296177Sjhibbits                                                                          by QMan if the target SRQ is almost full, to prevent QMan sequencer stalling. Stash transactions that are
617296177Sjhibbits                                                                          dropped will result in a fetch from main memory when a core reads the addressed coherency granule.
618296177Sjhibbits                                                                 If FALSE, Dequeued frame data, annotation, and FQ context stash transactions for this software portal will never be
619296177Sjhibbits                                                                           dropped by QMan. If the target SRQ is full a sequencer will stall until each stash transaction can be completed. */
620296177Sjhibbits} t_QmPortalStashParam;
621296177Sjhibbits
622296177Sjhibbits/**************************************************************************//**
623296177Sjhibbits @Description   structure representing QM-Portal initialization parameters
624296177Sjhibbits*//***************************************************************************/
625296177Sjhibbitstypedef struct {
626296177Sjhibbits    uintptr_t                       ceBaseAddress;          /**< Cache-enabled base address (virtual) */
627296177Sjhibbits    uintptr_t                       ciBaseAddress;          /**< Cache-inhibited base address (virtual) */
628296177Sjhibbits    t_Handle                        h_Qm;                   /**< Qm Handle */
629296177Sjhibbits    e_DpaaSwPortal                  swPortalId;             /**< Portal id */
630296177Sjhibbits    int                             irq;                    /**< portal interrupt line; used only if useIrq set to TRUE */
631296177Sjhibbits    uint16_t                        fdLiodnOffset;                /**< liodn to be used for all frames enqueued via this software portal */
632296177Sjhibbits    t_QmReceivedFrameCallback       *f_DfltFrame;           /**< this callback will be called unless specific callback assigned to the FQ*/
633296177Sjhibbits    t_QmRejectedFrameCallback       *f_RejectedFrame;       /**< this callback will be called for rejected frames. */
634296177Sjhibbits    t_Handle                        h_App;                  /**< a handle to the upper layer; It will be passed by the driver upon calling the CB */
635296177Sjhibbits} t_QmPortalParam;
636296177Sjhibbits
637296177Sjhibbits
638296177Sjhibbits/**************************************************************************//**
639296177Sjhibbits @Function      QM_PORTAL_Config
640296177Sjhibbits
641296177Sjhibbits @Description   Creates descriptor for a QM-Portal module.
642296177Sjhibbits
643296177Sjhibbits                The routine returns a handle (descriptor) to a QM-Portal object.
644296177Sjhibbits                This descriptor must be passed as first parameter to all other
645296177Sjhibbits                QM-Portal function calls.
646296177Sjhibbits
647296177Sjhibbits                No actual initialization or configuration of QM-Portal hardware is
648296177Sjhibbits                done by this routine.
649296177Sjhibbits
650296177Sjhibbits @Param[in]     p_QmPortalParam   - Pointer to data structure of parameters
651296177Sjhibbits
652296177Sjhibbits @Retval        Handle to a QM-Portal object, or NULL for Failure.
653296177Sjhibbits*//***************************************************************************/
654296177Sjhibbitst_Handle QM_PORTAL_Config(t_QmPortalParam *p_QmPortalParam);
655296177Sjhibbits
656296177Sjhibbits/**************************************************************************//**
657296177Sjhibbits @Function      QM_PORTAL_Init
658296177Sjhibbits
659296177Sjhibbits @Description   Initializes a QM-Portal module
660296177Sjhibbits
661296177Sjhibbits @Param[in]     h_QmPortal - A handle to a QM-Portal module
662296177Sjhibbits
663296177Sjhibbits @Return        E_OK on success; Error code otherwise.
664296177Sjhibbits*//***************************************************************************/
665296177Sjhibbitst_Error QM_PORTAL_Init(t_Handle h_QmPortal);
666296177Sjhibbits
667296177Sjhibbits/**************************************************************************//**
668296177Sjhibbits @Function      QM_PORTAL_Free
669296177Sjhibbits
670296177Sjhibbits @Description   Frees all resources that were assigned to a QM-Portal module.
671296177Sjhibbits
672296177Sjhibbits                Calling this routine invalidates the descriptor.
673296177Sjhibbits
674296177Sjhibbits @Param[in]     h_QmPortal - A handle to a QM-Portal module
675296177Sjhibbits
676296177Sjhibbits @Return        E_OK on success; Error code otherwise.
677296177Sjhibbits*//***************************************************************************/
678296177Sjhibbitst_Error QM_PORTAL_Free(t_Handle h_QmPortal);
679296177Sjhibbits
680296177Sjhibbits/**************************************************************************//**
681296177Sjhibbits @Group         QM_portal_advanced_init_grp    QM-Portal Advanced Configuration Unit
682296177Sjhibbits
683296177Sjhibbits @Description   Configuration functions used to change default values.
684296177Sjhibbits
685296177Sjhibbits @{
686296177Sjhibbits*//***************************************************************************/
687296177Sjhibbits
688296177Sjhibbits/**************************************************************************//**
689296177Sjhibbits @Function      QM_PORTAL_ConfigDcaMode
690296177Sjhibbits
691296177Sjhibbits @Description   Change the Discrate Consumption Acknowledge mode
692296177Sjhibbits                from its default configuration [FALSE].
693296177Sjhibbits
694296177Sjhibbits @Param[in]     h_QmPortal  - A handle to a QM-Portal module
695296177Sjhibbits @Param[in]     enable      - Enable/Disable DCA mode
696296177Sjhibbits
697296177Sjhibbits @Return        E_OK on success; Error code otherwise.
698296177Sjhibbits
699296177Sjhibbits @Cautions      Allowed only following QM_PORTAL_Config() and before QM_PORTAL_Init().
700296177Sjhibbits*//***************************************************************************/
701296177Sjhibbitst_Error QM_PORTAL_ConfigDcaMode(t_Handle h_QmPortal, bool enable);
702296177Sjhibbits
703296177Sjhibbits/**************************************************************************//**
704296177Sjhibbits @Function      QM_PORTAL_ConfigStash
705296177Sjhibbits
706296177Sjhibbits @Description   Config the portal to active stash mode.
707296177Sjhibbits
708296177Sjhibbits @Param[in]     h_QmPortal      - A handle to a QM-Portal module
709296177Sjhibbits @Param[in]     p_StashParams   - Pointer to data structure of parameters
710296177Sjhibbits
711296177Sjhibbits @Return        E_OK on success; Error code otherwise.
712296177Sjhibbits
713296177Sjhibbits @Cautions      Allowed only following QM_PORTAL_Config() and before QM_PORTAL_Init().
714296177Sjhibbits*//***************************************************************************/
715296177Sjhibbitst_Error QM_PORTAL_ConfigStash(t_Handle h_QmPortal, t_QmPortalStashParam *p_StashParams);
716296177Sjhibbits
717296177Sjhibbits
718296177Sjhibbits/**************************************************************************//**
719296177Sjhibbits @Function      QM_PORTAL_ConfigPullMode
720296177Sjhibbits
721296177Sjhibbits @Description   Change the Pull Mode from its default configuration [FALSE].
722296177Sjhibbits
723296177Sjhibbits @Param[in]     h_QmPortal  - A handle to a QM-Portal module
724296177Sjhibbits @Param[in]     pullMode    - When TRUE, the Portal will work in pull mode.
725296177Sjhibbits
726296177Sjhibbits @Return        E_OK on success; Error code otherwise.
727296177Sjhibbits
728296177Sjhibbits @Cautions      Allowed only following QM_PORTAL_Config() and before QM_PORTAL_Init().
729296177Sjhibbits*//***************************************************************************/
730296177Sjhibbitst_Error QM_PORTAL_ConfigPullMode(t_Handle h_QmPortal, bool pullMode);
731296177Sjhibbits
732296177Sjhibbits/** @} */ /* end of QM_portal_advanced_init_grp group */
733296177Sjhibbits/** @} */ /* end of QM_portal_init_grp group */
734296177Sjhibbits
735296177Sjhibbits
736296177Sjhibbits/**************************************************************************//**
737296177Sjhibbits @Group         QM_portal_runtime_control_grp QM-Portal Runtime Control Unit
738296177Sjhibbits
739296177Sjhibbits @Description   QM-Portal Runtime control unit API functions, definitions and enums.
740296177Sjhibbits
741296177Sjhibbits @{
742296177Sjhibbits*//***************************************************************************/
743296177Sjhibbits
744296177Sjhibbits/**************************************************************************//**
745296177Sjhibbits @Function      QM_PORTAL_AddPoolChannel
746296177Sjhibbits
747296177Sjhibbits @Description   Adding the pool channel to the SW-Portal's scheduler.
748296177Sjhibbits                the sw-portal will get frames that came from the pool channel.
749296177Sjhibbits
750296177Sjhibbits @Param[in]     h_QmPortal      - A handle to a QM-Portal module
751296177Sjhibbits @Param[in]     poolChannelId   - Pool channel id. must between '0' to QM_MAX_NUM_OF_POOL_CHANNELS
752296177Sjhibbits
753296177Sjhibbits @Return        E_OK on success; Error code otherwise.
754296177Sjhibbits
755296177Sjhibbits @Cautions      Allowed only following QM_PORTAL_Init().
756296177Sjhibbits*//***************************************************************************/
757296177Sjhibbitst_Error QM_PORTAL_AddPoolChannel(t_Handle h_QmPortal, uint8_t poolChannelId);
758296177Sjhibbits
759296177Sjhibbits/** @} */ /* end of QM_portal_runtime_control_grp group */
760296177Sjhibbits
761296177Sjhibbits
762296177Sjhibbits/**************************************************************************//**
763296177Sjhibbits @Group         QM_portal_runtime_data_grp QM-Portal Runtime Data Unit
764296177Sjhibbits
765296177Sjhibbits @Description   QM-Portal Runtime data unit API functions, definitions and enums.
766296177Sjhibbits
767296177Sjhibbits @{
768296177Sjhibbits*//***************************************************************************/
769296177Sjhibbits
770296177Sjhibbits/**************************************************************************//**
771296177Sjhibbits @Description structure representing QM Portal Frame Info
772296177Sjhibbits*//***************************************************************************/
773296177Sjhibbitstypedef struct t_QmPortalFrameInfo {
774296177Sjhibbits    t_Handle    h_App;
775296177Sjhibbits    t_Handle    h_QmFqr;
776296177Sjhibbits    uint32_t    fqidOffset;
777296177Sjhibbits    t_DpaaFD    frame;
778296177Sjhibbits} t_QmPortalFrameInfo;
779296177Sjhibbits
780296177Sjhibbits/**************************************************************************//**
781296177Sjhibbits @Function      QM_PORTAL_Poll
782296177Sjhibbits
783296177Sjhibbits @Description   Poll frames from the specified sw-portal.
784296177Sjhibbits
785296177Sjhibbits @Param[in]     h_QmPortal      - A handle to a QM-Portal module
786296177Sjhibbits @Param[in]     source          - The selected frames type to poll
787296177Sjhibbits
788296177Sjhibbits @Return        E_OK on success; Error code otherwise.
789296177Sjhibbits
790296177Sjhibbits @Cautions      Allowed only following QM_PORTAL_Init().
791296177Sjhibbits*//***************************************************************************/
792296177Sjhibbitst_Error QM_PORTAL_Poll(t_Handle h_QmPortal, e_QmPortalPollSource source);
793296177Sjhibbits
794296177Sjhibbits/**************************************************************************//**
795296177Sjhibbits @Function      QM_PORTAL_PollFrame
796296177Sjhibbits
797296177Sjhibbits @Description   Poll frames from the specified sw-portal. will poll only data frames
798296177Sjhibbits
799296177Sjhibbits @Param[in]     h_QmPortal      - A handle to a QM-Portal module
800296177Sjhibbits @Param[out]    p_frameInfo     - A structure to hold the dequeued frame information
801296177Sjhibbits
802296177Sjhibbits @Return        E_OK on success; Error code otherwise.
803296177Sjhibbits
804296177Sjhibbits @Cautions      Allowed only following QM_PORTAL_Init().
805296177Sjhibbits*//***************************************************************************/
806296177Sjhibbitst_Error QM_PORTAL_PollFrame(t_Handle h_QmPortal, t_QmPortalFrameInfo *p_frameInfo);
807296177Sjhibbits
808296177Sjhibbits
809296177Sjhibbits/** @} */ /* end of QM_portal_runtime_data_grp group */
810296177Sjhibbits/** @} */ /* end of QM_portal_grp group */
811296177Sjhibbits
812296177Sjhibbits
813296177Sjhibbits/**************************************************************************//**
814296177Sjhibbits @Group         QM_fqr_grp QM Frame-Queue-Range API
815296177Sjhibbits
816296177Sjhibbits @Description   QM-FQR API functions, definitions and enums.
817296177Sjhibbits
818296177Sjhibbits @{
819296177Sjhibbits*//***************************************************************************/
820296177Sjhibbits
821296177Sjhibbits/**************************************************************************//**
822296177Sjhibbits @Group         QM_fqr_init_grp QM-FQR Initialization Unit
823296177Sjhibbits
824296177Sjhibbits @Description   QM-FQR Initialization Unit
825296177Sjhibbits
826296177Sjhibbits @{
827296177Sjhibbits*//***************************************************************************/
828296177Sjhibbits
829296177Sjhibbits
830296177Sjhibbits/**************************************************************************//**
831296177Sjhibbits @Description structure representing QM FQ-Range congestion group parameters
832296177Sjhibbits*//***************************************************************************/
833296177Sjhibbitstypedef struct {
834296177Sjhibbits    t_Handle    h_QmCg;                     /**< A handle to the congestion group. */
835296177Sjhibbits    int8_t      overheadAccountingLength;   /**< For each frame add this number for CG calculation
836296177Sjhibbits                                                 (may be negative), if 0 - disable feature */
837296177Sjhibbits    uint32_t    fqTailDropThreshold;        /**< if not "0" - enable tail drop on this FQR */
838296177Sjhibbits} t_QmFqrCongestionAvoidanceParams;
839296177Sjhibbits
840296177Sjhibbits/**************************************************************************//**
841296177Sjhibbits @Description   structure representing QM FQ-Range initialization parameters
842296177Sjhibbits*//***************************************************************************/
843296177Sjhibbitstypedef struct {
844296177Sjhibbits    t_Handle            h_Qm;           /**< A handle to a QM module */
845296177Sjhibbits    t_Handle            h_QmPortal;     /**< A handle to a QM Portal Module;
846296177Sjhibbits                                             will be used only for Init and Free routines;
847296177Sjhibbits                                             NOTE : if NULL, assuming affinity */
848296177Sjhibbits    bool                initParked;     /**< This FQ-Range will be initialize in park state (un-schedule) */
849296177Sjhibbits    bool                holdActive;     /**< This FQ-Range can be parked (un-schedule);
850296177Sjhibbits                                             This affects only on queues destined to software portals*/
851296177Sjhibbits    bool                preferInCache;  /**< Prefer this FQ-Range to be in QMAN's internal cache for all states */
852296177Sjhibbits    bool                useContextAForStash;/**< This FQ-Range will use context A for stash */
853296177Sjhibbits    union {
854296177Sjhibbits        struct {
855296177Sjhibbits            uint8_t     frameAnnotationSize;/**< Size of Frame Annotation to be stashed */
856296177Sjhibbits            uint8_t     frameDataSize;      /**< Size of Frame Data to be stashed. */
857296177Sjhibbits            uint8_t     fqContextSize;      /**< Size of FQ context to be stashed. */
858296177Sjhibbits            uint64_t    fqContextAddr;      /**< 40 bit memory address containing the FQ context information to be stashed;
859296177Sjhibbits                                                 Must be cacheline-aligned */
860296177Sjhibbits        } stashingParams;
861296177Sjhibbits        t_QmContextA    *p_ContextA;    /**< context-A field to be written in the FQ structure */
862296177Sjhibbits    };
863296177Sjhibbits    t_QmContextB        *p_ContextB;    /**< context-B field to be written in the FQ structure;
864296177Sjhibbits                                             Note that this field may be used for Tx queues only! */
865296177Sjhibbits    e_QmFQChannel       channel;        /**< Qm Channel */
866296177Sjhibbits    uint8_t             wq;             /**< Work queue within the channel */
867296177Sjhibbits    bool                shadowMode;     /**< If TRUE, useForce MUST set to TRUE and numOfFqids MUST set to '1' */
868296177Sjhibbits    uint32_t            numOfFqids;     /**< number of fqids to be allocated*/
869296177Sjhibbits    bool                useForce;       /**< TRUE - force allocation of specific fqids;
870296177Sjhibbits                                             FALSE - allocate several fqids */
871296177Sjhibbits    union{
872296177Sjhibbits        struct {
873296177Sjhibbits            uint32_t    align;          /**< alignment. will be used if useForce=FALSE */
874296177Sjhibbits        } nonFrcQs;
875296177Sjhibbits        struct {
876296177Sjhibbits            uint32_t    fqid;           /**< the fqid base of the forced fqids. will be used if useForce=TRUE */
877296177Sjhibbits        } frcQ;
878296177Sjhibbits    } qs;
879296177Sjhibbits    bool                congestionAvoidanceEnable;
880296177Sjhibbits                                        /**< TRUE to enable congestion avoidance mechanism */
881296177Sjhibbits    t_QmFqrCongestionAvoidanceParams    congestionAvoidanceParams;
882296177Sjhibbits                                        /**< Parameters for congestion avoidance */
883296177Sjhibbits} t_QmFqrParams;
884296177Sjhibbits
885296177Sjhibbits
886296177Sjhibbits/**************************************************************************//**
887296177Sjhibbits @Function      QM_FQR_Create
888296177Sjhibbits
889296177Sjhibbits @Description   Initializing and enabling a Frame-Queue-Range.
890296177Sjhibbits                This routine should be called for adding an FQR.
891296177Sjhibbits
892296177Sjhibbits @Param[in]     p_QmFqrParams   - A structure of parameters for defining the
893296177Sjhibbits                                  desired queues parameters.
894296177Sjhibbits
895296177Sjhibbits @Return        A handle to the initialized FQR on success; NULL code otherwise.
896296177Sjhibbits
897296177Sjhibbits @Cautions      Allowed only following QM_Init().
898296177Sjhibbits*//***************************************************************************/
899296177Sjhibbitst_Handle QM_FQR_Create(t_QmFqrParams *p_QmFqrParams);
900296177Sjhibbits
901296177Sjhibbits/**************************************************************************//**
902296177Sjhibbits @Function      QM_FQR_Free
903296177Sjhibbits
904296177Sjhibbits @Description   Deleting and free all resources of an initialized FQR.
905296177Sjhibbits
906296177Sjhibbits @Param[in]     h_QmFqr         - A handle to a QM-FQR Module.
907296177Sjhibbits
908296177Sjhibbits @Return        E_OK on success; Error code otherwise.
909296177Sjhibbits
910296177Sjhibbits @Cautions      Allowed only following QM_Init() and QM_FQR_Create() for this FQR.
911296177Sjhibbits*//***************************************************************************/
912296177Sjhibbitst_Error QM_FQR_Free(t_Handle h_QmFqr);
913296177Sjhibbits
914296177Sjhibbits/**************************************************************************//**
915296177Sjhibbits @Function      QM_FQR_FreeWDrain
916296177Sjhibbits
917296177Sjhibbits @Description   Deleting and free all resources of an initialized FQR
918296177Sjhibbits                with the option of draining.
919296177Sjhibbits
920296177Sjhibbits @Param[in]     h_QmFqr         - A handle to a QM-FQR Module.
921296177Sjhibbits @Param[in]     f_CompletionCB  - Pointer to a completion callback to be used in non-blocking mode.
922296177Sjhibbits @Param[in]     deliverFrame    - TRUE for deliver the drained frames to the user;
923296177Sjhibbits                                  FALSE for not deliver the frames.
924296177Sjhibbits @Param[in]     f_CallBack      - Pointer to a callback to handle the delivered frames.
925296177Sjhibbits @Param[in]     h_App           - User's application descriptor.
926296177Sjhibbits
927296177Sjhibbits @Return        E_OK on success; Error code otherwise.
928296177Sjhibbits
929296177Sjhibbits @Cautions      Allowed only following QM_Init() and QM_FQR_Create() for this FQR.
930296177Sjhibbits*//***************************************************************************/
931296177Sjhibbitst_Error QM_FQR_FreeWDrain(t_Handle                     h_QmFqr,
932296177Sjhibbits                          t_QmFqrDrainedCompletionCB   *f_CompletionCB,
933296177Sjhibbits                          bool                         deliverFrame,
934296177Sjhibbits                          t_QmReceivedFrameCallback    *f_CallBack,
935296177Sjhibbits                          t_Handle                     h_App);
936296177Sjhibbits
937296177Sjhibbits/** @} */ /* end of QM_fqr_init_grp group */
938296177Sjhibbits
939296177Sjhibbits
940296177Sjhibbits/**************************************************************************//**
941296177Sjhibbits @Group         QM_fqr_runtime_control_grp QM-FQR Runtime Control Unit
942296177Sjhibbits
943296177Sjhibbits @Description   QM-FQR Runtime control unit API functions, definitions and enums.
944296177Sjhibbits
945296177Sjhibbits @{
946296177Sjhibbits*//***************************************************************************/
947296177Sjhibbits
948296177Sjhibbits/**************************************************************************//**
949296177Sjhibbits @Description   enum for defining QM-FQR counters
950296177Sjhibbits*//***************************************************************************/
951296177Sjhibbitstypedef enum e_QmFqrCounters {
952296177Sjhibbits    e_QM_FQR_COUNTERS_FRAME = 0,        /**< Total number of frames on this frame queue */
953296177Sjhibbits    e_QM_FQR_COUNTERS_BYTE              /**< Total number of bytes in all frames on this frame queue */
954296177Sjhibbits} e_QmFqrCounters;
955296177Sjhibbits
956296177Sjhibbits/**************************************************************************//**
957296177Sjhibbits @Function      QM_FQR_RegisterCB
958296177Sjhibbits
959296177Sjhibbits @Description   Register a callback routine to be called when a frame comes from this FQ-Range
960296177Sjhibbits
961296177Sjhibbits @Param[in]     h_QmFqr         - A handle to a QM-FQR Module.
962296177Sjhibbits @Param[in]     f_CallBack      - An application callback
963296177Sjhibbits @Param[in]     h_App           - User's application descriptor
964296177Sjhibbits
965296177Sjhibbits @Return        E_OK on success; Error code otherwise.
966296177Sjhibbits
967296177Sjhibbits @Cautions      Allowed only following QM_FQR_Create().
968296177Sjhibbits*//***************************************************************************/
969296177Sjhibbitst_Error QM_FQR_RegisterCB(t_Handle h_QmFqr, t_QmReceivedFrameCallback *f_CallBack, t_Handle h_App);
970296177Sjhibbits
971296177Sjhibbits/**************************************************************************//**
972296177Sjhibbits @Function      QM_FQR_Resume
973296177Sjhibbits
974296177Sjhibbits @Description   Request to Re-Schedule this Fqid.
975296177Sjhibbits
976296177Sjhibbits @Param[in]     h_QmFqr         - A handle to a QM-FQR Module.
977296177Sjhibbits @Param[in]     h_QmPortal      - A handle to a QM Portal Module;
978296177Sjhibbits                                  NOTE : if NULL, assuming affinity.
979296177Sjhibbits @Param[in]     fqidOffset      - Fqid offset within the FQ-Range.
980296177Sjhibbits
981296177Sjhibbits @Return        E_OK on success; Error code otherwise.
982296177Sjhibbits
983296177Sjhibbits @Cautions      Allowed only following QM_FQR_Create().
984296177Sjhibbits*//***************************************************************************/
985296177Sjhibbitst_Error QM_FQR_Resume(t_Handle h_QmFqr, t_Handle h_QmPortal, uint32_t fqidOffset);
986296177Sjhibbits
987296177Sjhibbits/**************************************************************************//**
988296177Sjhibbits @Function      QM_FQR_Suspend
989296177Sjhibbits
990296177Sjhibbits @Description   Request to Un-Schedule this Fqid.
991296177Sjhibbits
992296177Sjhibbits @Param[in]     h_QmFqr         - A handle to a QM-FQR Module.
993296177Sjhibbits @Param[in]     h_QmPortal      - A handle to a QM Portal Module;
994296177Sjhibbits                                  NOTE : if NULL, assuming affinity.
995296177Sjhibbits @Param[in]     fqidOffset      - Fqid offset within the FQ-Range.
996296177Sjhibbits
997296177Sjhibbits @Return        E_OK on success; Error code otherwise.
998296177Sjhibbits
999296177Sjhibbits @Cautions      Allowed only following QM_FQR_Create().
1000296177Sjhibbits*//***************************************************************************/
1001296177Sjhibbitst_Error QM_FQR_Suspend(t_Handle h_QmFqr, t_Handle h_QmPortal, uint32_t fqidOffset);
1002296177Sjhibbits
1003296177Sjhibbits/**************************************************************************//**
1004296177Sjhibbits @Function      QM_FQR_GetFqid
1005296177Sjhibbits
1006296177Sjhibbits @Description   Returned the Fqid base of the FQ-Range
1007296177Sjhibbits
1008296177Sjhibbits @Param[in]     h_QmFqr         - A handle to a QM-FQR Module.
1009296177Sjhibbits
1010296177Sjhibbits @Return        Fqid base.
1011296177Sjhibbits
1012296177Sjhibbits @Cautions      Allowed only following QM_FQR_Create().
1013296177Sjhibbits*//***************************************************************************/
1014296177Sjhibbitsuint32_t QM_FQR_GetFqid(t_Handle h_QmFqr);
1015296177Sjhibbits
1016296177Sjhibbits/**************************************************************************//**
1017296177Sjhibbits @Function      QM_FQR_GetCounter
1018296177Sjhibbits
1019296177Sjhibbits @Description   Reads one of the QM-FQR counters.
1020296177Sjhibbits
1021296177Sjhibbits @Param[in]     h_QmFqr         - A handle to a QM-FQR Module.
1022296177Sjhibbits @Param[in]     h_QmPortal      - A handle to a QM Portal Module;
1023296177Sjhibbits                                  NOTE : if NULL, assuming affinity.
1024296177Sjhibbits @Param[in]     fqidOffset      - Fqid offset within the FQ-Range.
1025296177Sjhibbits @Param[in]     counter         - The requested counter.
1026296177Sjhibbits
1027296177Sjhibbits @Return        Counter's current value.
1028296177Sjhibbits
1029296177Sjhibbits @Cautions      Allowed only following QM_FQR_Create().
1030296177Sjhibbits*//***************************************************************************/
1031296177Sjhibbitsuint32_t QM_FQR_GetCounter(t_Handle h_QmFqr, t_Handle h_QmPortal, uint32_t fqidOffset, e_QmFqrCounters counter);
1032296177Sjhibbits
1033296177Sjhibbits/** @} */ /* end of QM_fqr_runtime_control_grp group */
1034296177Sjhibbits
1035296177Sjhibbits
1036296177Sjhibbits/**************************************************************************//**
1037296177Sjhibbits @Group         QM_fqr_runtime_data_grp QM-FQR Runtime Data Unit
1038296177Sjhibbits
1039296177Sjhibbits @Description   QM-FQR Runtime data unit API functions, definitions and enums.
1040296177Sjhibbits
1041296177Sjhibbits @{
1042296177Sjhibbits*//***************************************************************************/
1043296177Sjhibbits
1044296177Sjhibbits/**************************************************************************//**
1045296177Sjhibbits @Function      QM_FQR_Enqueue
1046296177Sjhibbits
1047296177Sjhibbits @Description   Enqueue the frame into the FQ to be transmitted.
1048296177Sjhibbits
1049296177Sjhibbits @Param[in]     h_QmFqr         - A handle to a QM-FQR Module.
1050296177Sjhibbits @Param[in]     h_QmPortal      - A handle to a QM Portal Module;
1051296177Sjhibbits                                  NOTE : if NULL, assuming affinity.
1052296177Sjhibbits @Param[in]     fqidOffset      - Fqid offset within the FQ-Range.
1053296177Sjhibbits @Param[in]     p_Frame         - Pointer to the frame to be enqueued.
1054296177Sjhibbits
1055296177Sjhibbits @Return        E_OK on success; Error code otherwise.
1056296177Sjhibbits
1057296177Sjhibbits @Cautions      Allowed only following QM_FQR_Create().
1058296177Sjhibbits*//***************************************************************************/
1059296177Sjhibbitst_Error QM_FQR_Enqueue(t_Handle h_QmFqr, t_Handle h_QmPortal, uint32_t fqidOffset, t_DpaaFD *p_Frame);
1060296177Sjhibbits
1061296177Sjhibbits/**************************************************************************//**
1062296177Sjhibbits @Function      QM_FQR_PullFrame
1063296177Sjhibbits
1064296177Sjhibbits @Description   Perform a Pull command.
1065296177Sjhibbits
1066296177Sjhibbits @Param[in]     h_QmFqr         - A handle to a QM-FQR Module.
1067296177Sjhibbits @Param[in]     h_QmPortal      - A handle to a QM Portal Module;
1068296177Sjhibbits                                  NOTE : if NULL, assuming affinity.
1069296177Sjhibbits @Param[in]     fqidOffset      - Fqid offset within the FQ-Range.
1070296177Sjhibbits @Param[out]    p_Frame         - The Received Frame
1071296177Sjhibbits
1072296177Sjhibbits @Return        E_OK on success; Error code otherwise.
1073296177Sjhibbits
1074296177Sjhibbits @Cautions      Allowed only following QM_PORTAL_Init().
1075296177Sjhibbits*//***************************************************************************/
1076296177Sjhibbitst_Error QM_FQR_PullFrame(t_Handle h_QmFqr, t_Handle h_QmPortal, uint32_t fqidOffset, t_DpaaFD *p_Frame);
1077296177Sjhibbits
1078296177Sjhibbits
1079296177Sjhibbits/** @} */ /* end of QM_fqr_runtime_data_grp group */
1080296177Sjhibbits/** @} */ /* end of QM_fqr_grp group */
1081296177Sjhibbits
1082296177Sjhibbits
1083296177Sjhibbits/**************************************************************************//**
1084296177Sjhibbits @Group         QM_cg_grp QM Congestion Group API
1085296177Sjhibbits
1086296177Sjhibbits @Description   QM-CG API functions, definitions and enums.
1087296177Sjhibbits
1088296177Sjhibbits @{
1089296177Sjhibbits*//***************************************************************************/
1090296177Sjhibbits
1091296177Sjhibbits/**************************************************************************//**
1092296177Sjhibbits @Group         QM_cg_init_grp QM-Congestion Group Initialization Unit
1093296177Sjhibbits
1094296177Sjhibbits @Description   QM-CG Initialization Unit
1095296177Sjhibbits
1096296177Sjhibbits @{
1097296177Sjhibbits*//***************************************************************************/
1098296177Sjhibbits
1099296177Sjhibbits/**************************************************************************//**
1100296177Sjhibbits @Description   structure representing QM CG WRED curve
1101296177Sjhibbits*//***************************************************************************/
1102296177Sjhibbitstypedef struct t_QmCgWredCurve {
1103296177Sjhibbits    uint32_t    maxTh;                  /**< minimum threshold - below this level
1104296177Sjhibbits                                             all packets are rejected (approximated
1105296177Sjhibbits                                             to be expressed as x*2^y due to HW
1106296177Sjhibbits                                             implementation)*/
1107296177Sjhibbits    uint32_t    minTh;                  /**< minimum threshold - below this level
1108296177Sjhibbits                                             all packets are accepted (approximated
1109296177Sjhibbits                                             due to HW implementation)*/
1110296177Sjhibbits    uint8_t    probabilityDenominator;  /**< 1-64, the fraction of packets dropped
1111296177Sjhibbits                                             when the average queue depth is at the
1112296177Sjhibbits                                             maximum threshold.(approximated due to HW
1113296177Sjhibbits                                             implementation). */
1114296177Sjhibbits} t_QmCgWredCurve;
1115296177Sjhibbits
1116296177Sjhibbits/**************************************************************************//**
1117296177Sjhibbits @Description   structure representing QM CG WRED parameters
1118296177Sjhibbits*//***************************************************************************/
1119296177Sjhibbitstypedef struct t_QmCgWredParams {
1120296177Sjhibbits    bool            enableGreen;
1121296177Sjhibbits    t_QmCgWredCurve greenCurve;
1122296177Sjhibbits    bool            enableYellow;
1123296177Sjhibbits    t_QmCgWredCurve yellowCurve;
1124296177Sjhibbits    bool            enableRed;
1125296177Sjhibbits    t_QmCgWredCurve redCurve;
1126296177Sjhibbits} t_QmCgWredParams;
1127296177Sjhibbits
1128296177Sjhibbits/**************************************************************************//**
1129296177Sjhibbits @Description   structure representing QM CG configuration parameters
1130296177Sjhibbits*//***************************************************************************/
1131296177Sjhibbitstypedef struct t_QmCgParams {
1132296177Sjhibbits    t_Handle                h_Qm;           /**< A handle to a QM module */
1133296177Sjhibbits    t_Handle                h_QmPortal;     /**< A handle to a QM Portal Module;
1134296177Sjhibbits                                                 will be used for Init, Free and as
1135296177Sjhibbits                                                 an interrupt destination for cg state
1136296177Sjhibbits                                                 change (if CgStateChangeEnable = TRUE) */
1137296177Sjhibbits    bool                    frameCount;     /**< TRUE for frame count, FALSE - byte count */
1138296177Sjhibbits    bool                    wredEnable;     /**< if TRUE - WRED enabled. Each color is enabled independently
1139296177Sjhibbits                                                 so that some colors may use WRED, but others may use
1140296177Sjhibbits                                                 Tail drop - if enabled, or none.  */
1141296177Sjhibbits    t_QmCgWredParams        wredParams;     /**< WRED parameters, relevant if wredEnable = TRUE*/
1142296177Sjhibbits    bool                    tailDropEnable; /**< if TRUE - Tail drop enabled */
1143296177Sjhibbits    uint32_t                threshold;      /**< If Tail drop - used as Tail drop threshold, otherwise
1144296177Sjhibbits                                                 'threshold' may still be used to receive notifications
1145296177Sjhibbits                                                 when threshold is passed. If threshold and f_Exception
1146296177Sjhibbits                                                 are set, interrupts are set defaultly by driver. */
1147296177Sjhibbits    bool                    notifyDcPortal; /**< Relevant if this CG receives enqueues from a direct portal
1148296177Sjhibbits                                                 e_DPAA_DCPORTAL0 or e_DPAA_DCPORTAL1. TRUE to notify
1149296177Sjhibbits                                                 the DC portal, FALSE to notify this SW portal. */
1150296177Sjhibbits    e_DpaaDcPortal          dcPortalId;     /**< relevant if notifyDcPortal=TRUE - DC Portal id */
1151296177Sjhibbits    t_QmExceptionsCallback  *f_Exception;   /**< relevant and mandatory if threshold is configured and
1152296177Sjhibbits                                                 notifyDcPortal = FALSE. If threshold and f_Exception
1153296177Sjhibbits                                                 are set, interrupts are set defaultly by driver */
1154296177Sjhibbits    t_Handle                h_App;          /**< A handle to the application layer, will be passed as
1155296177Sjhibbits                                                 argument to f_Exception */
1156296177Sjhibbits} t_QmCgParams;
1157296177Sjhibbits
1158296177Sjhibbits
1159296177Sjhibbits/**************************************************************************//**
1160296177Sjhibbits @Function      QM_CG_Create
1161296177Sjhibbits
1162296177Sjhibbits @Description   Create and configure a congestion Group.
1163296177Sjhibbits
1164296177Sjhibbits @Param[in]     p_CgParams      - CG parameters
1165296177Sjhibbits
1166296177Sjhibbits @Return        A handle to the CG module
1167296177Sjhibbits
1168296177Sjhibbits @Cautions      Allowed only following QM_Init().
1169296177Sjhibbits*//***************************************************************************/
1170296177Sjhibbitst_Handle    QM_CG_Create(t_QmCgParams *p_CgParams);
1171296177Sjhibbits
1172296177Sjhibbits/**************************************************************************//**
1173296177Sjhibbits @Function      QM_CG_Free
1174296177Sjhibbits
1175296177Sjhibbits @Description   Deleting and free all resources of an initialized CG.
1176296177Sjhibbits
1177296177Sjhibbits @Param[in]     h_QmCg         - A handle to a QM-CG Module.
1178296177Sjhibbits
1179296177Sjhibbits @Return        E_OK on success; Error code otherwise.
1180296177Sjhibbits
1181296177Sjhibbits @Cautions      Allowed only following QM_Init() and QM_CR_Create() for this CG.
1182296177Sjhibbits*//***************************************************************************/
1183296177Sjhibbitst_Error QM_CG_Free(t_Handle h_QmCg);
1184296177Sjhibbits
1185296177Sjhibbits/** @} */ /* end of QM_cg_init_grp group */
1186296177Sjhibbits
1187296177Sjhibbits
1188296177Sjhibbits/**************************************************************************//**
1189296177Sjhibbits @Group         QM_cg_runtime_control_grp QM-CG Runtime Control Unit
1190296177Sjhibbits
1191296177Sjhibbits @Description   QM-CG Runtime control unit API functions, definitions and enums.
1192296177Sjhibbits
1193296177Sjhibbits @{
1194296177Sjhibbits*//***************************************************************************/
1195296177Sjhibbits
1196296177Sjhibbits/**************************************************************************//**
1197296177Sjhibbits @Description   structure representing QM CG WRED colors
1198296177Sjhibbits*//***************************************************************************/
1199296177Sjhibbitstypedef enum e_QmCgColor {
1200296177Sjhibbits    e_QM_CG_COLOR_GREEN,
1201296177Sjhibbits    e_QM_CG_COLOR_YELLOW,
1202296177Sjhibbits    e_QM_CG_COLOR_RED
1203296177Sjhibbits} e_QmCgColor;
1204296177Sjhibbits
1205296177Sjhibbits/**************************************************************************//**
1206296177Sjhibbits @Description   structure representing QM CG modification parameters
1207296177Sjhibbits*//***************************************************************************/
1208296177Sjhibbitstypedef struct t_QmCgModifyWredParams {
1209296177Sjhibbits    e_QmCgColor         color;
1210296177Sjhibbits    bool                enable;
1211296177Sjhibbits    t_QmCgWredCurve     wredParams;
1212296177Sjhibbits} t_QmCgModifyWredParams;
1213296177Sjhibbits
1214296177Sjhibbits
1215296177Sjhibbits/**************************************************************************//**
1216296177Sjhibbits @Function      QM_CG_SetException
1217296177Sjhibbits
1218296177Sjhibbits @Description   Set CG exception.
1219296177Sjhibbits
1220296177Sjhibbits @Param[in]     h_QmCg         - A handle to a QM-CG Module.
1221296177Sjhibbits @Param[in]     exception      - exception enum
1222296177Sjhibbits @Param[in]     enable         - TRUE to enable, FALSE to disable.
1223296177Sjhibbits
1224296177Sjhibbits @Return        E_OK on success; Error code otherwise.
1225296177Sjhibbits
1226296177Sjhibbits @Cautions      Allowed only following QM_Init() and QM_CG_Create() for this CG.
1227296177Sjhibbits*//***************************************************************************/
1228296177Sjhibbitst_Error QM_CG_SetException(t_Handle h_QmCg, e_QmExceptions exception, bool enable);
1229296177Sjhibbits
1230296177Sjhibbits/**************************************************************************//**
1231296177Sjhibbits @Function      QM_CG_ModifyWredCurve
1232296177Sjhibbits
1233296177Sjhibbits @Description   Change WRED curve parameters for a selected color.
1234296177Sjhibbits                Note that this routine may be called only for valid CG's that
1235296177Sjhibbits                already have been configured for WRED, and only need a change
1236296177Sjhibbits                in the WRED parameters.
1237296177Sjhibbits
1238296177Sjhibbits @Param[in]     h_QmCg              - A handle to a QM-CG Module.
1239296177Sjhibbits @Param[in]     p_QmCgModifyParams  - A structure of new WRED parameters.
1240296177Sjhibbits
1241296177Sjhibbits @Return        E_OK on success; Error code otherwise.
1242296177Sjhibbits
1243296177Sjhibbits @Cautions      Allowed only following QM_Init() and QM_CG_Create() for this CG.
1244296177Sjhibbits*//***************************************************************************/
1245296177Sjhibbitst_Error QM_CG_ModifyWredCurve(t_Handle h_QmCg, t_QmCgModifyWredParams *p_QmCgModifyParams);
1246296177Sjhibbits
1247296177Sjhibbits/**************************************************************************//**
1248296177Sjhibbits @Function      QM_CG_ModifyTailDropThreshold
1249296177Sjhibbits
1250296177Sjhibbits @Description   Change WRED curve parameters for a selected color.
1251296177Sjhibbits                Note that this routine may be called only for valid CG's that
1252296177Sjhibbits                already have been configured for tail drop, and only need a change
1253296177Sjhibbits                in the threshold value.
1254296177Sjhibbits
1255296177Sjhibbits @Param[in]     h_QmCg              - A handle to a QM-CG Module.
1256296177Sjhibbits @Param[in]     threshold           - New threshold.
1257296177Sjhibbits
1258296177Sjhibbits @Return        E_OK on success; Error code otherwise.
1259296177Sjhibbits
1260296177Sjhibbits @Cautions      Allowed only following QM_Init() and QM_CG_Create() for this CG.
1261296177Sjhibbits*//***************************************************************************/
1262296177Sjhibbitst_Error QM_CG_ModifyTailDropThreshold(t_Handle h_QmCg, uint32_t threshold);
1263296177Sjhibbits
1264296177Sjhibbits
1265296177Sjhibbits/** @} */ /* end of QM_cg_runtime_control_grp group */
1266296177Sjhibbits/** @} */ /* end of QM_cg_grp group */
1267296177Sjhibbits/** @} */ /* end of QM_grp group */
1268296177Sjhibbits
1269296177Sjhibbits
1270296177Sjhibbits#endif /* __QM_EXT_H */
1271