1/*
2 * txDataQueue.h
3 *
4 * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 *  * Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 *  * Redistributions in binary form must reproduce the above copyright
14 *    notice, this list of conditions and the following disclaimer in
15 *    the documentation and/or other materials provided with the
16 *    distribution.
17 *  * Neither the name Texas Instruments nor the names of its
18 *    contributors may be used to endorse or promote products derived
19 *    from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34
35/***************************************************************************/
36/*																		   */
37/*	  MODULE:	TxDataQueue.h										       */
38/*    PURPOSE:	Tx Data Queue module Header file						   */
39/*																		   */
40/***************************************************************************/
41#ifndef _TX_DATA_QUEUE_H_
42#define _TX_DATA_QUEUE_H_
43
44
45#include "TWDriver.h"
46#include "DataCtrl_Api.h"
47
48
49/*#define CLSFR_MODULE_LOG	TX_DATA_QUEUE_MODULE_LOG removed by eran*/
50
51/* Max number of packets in each queue */
52#define DATA_QUEUE_DEPTH_BE  40
53#define DATA_QUEUE_DEPTH_BK  10
54#define DATA_QUEUE_DEPTH_VI  20
55#define DATA_QUEUE_DEPTH_VO  10
56#define DATA_QUEUE_DEPTH_TOTAL  (DATA_QUEUE_DEPTH_BE + DATA_QUEUE_DEPTH_BK + DATA_QUEUE_DEPTH_VI + DATA_QUEUE_DEPTH_VO)
57
58/* Verify that there are enough TxCtrlBlks for all users that are queueing packets (driver + FW) */
59#if ((DATA_QUEUE_DEPTH_TOTAL + (MGMT_QUEUES_DEPTH * 2) + NUM_TX_DESCRIPTORS) > (CTRL_BLK_ENTRIES_NUM - 2))
60    #error  Not enough TxCtrlBlks for all users !!
61#endif
62
63/* Tx packets handling statistics */
64typedef struct
65{
66	TI_UINT32 uEnqueuePacket;
67	TI_UINT32 uDequeuePacket;
68	TI_UINT32 uRequeuePacket;
69	TI_UINT32 uXmittedPacket;
70	TI_UINT32 uDroppedPacket;
71} TTxDataQueueDebugCnt;
72
73/* The module's object */
74typedef struct
75{
76	TI_HANDLE            hContext;
77	TI_HANDLE            hTxCtrl;
78	TI_HANDLE            hOs;
79	TI_HANDLE            hReport;
80	TI_HANDLE            hTxMgmtQ;
81
82	TClsfrParams		 tClsfrParams;  /* The classifier sub-module parameters */
83
84	TI_BOOL              bDataPortEnable; /* Data port open or not */
85    TI_UINT32            uContextId;  /* ID allocated to this module on registration to context module */
86
87	/* Tx aQueues */
88	TI_UINT32            uNumQueues; /* Indicates the number of allocated aQueues */
89	TI_UINT32            aQueueMaxSize[MAX_NUM_OF_AC]; /* indicates the max size of each Data queue */
90	TI_HANDLE            aQueues[MAX_NUM_OF_AC];  /* The Tx aQueues handles */
91    TI_BOOL	             aQueueBusy[MAX_NUM_OF_AC]; /* per queue busy indication */
92	TI_UINT32            uLastQueId; /* the last queue processed by the scheduler */
93
94	/* Counters */
95	TTxDataQueueDebugCnt aQueueCounters[MAX_NUM_OF_AC]; /* Save Tx statistics per Tx-queue. */
96	TI_UINT32			 uClsfrMismatchCount;
97
98} TTxDataQ;
99
100
101/* TIDs Mapping to Queues */
102static const TI_UINT32 aTidToQueueTable[MAX_NUM_OF_802_1d_TAGS] = {0, 1, 1, 0, 2, 2, 3, 3};
103
104
105#endif /* _TX_DATA_QUEUE_H_ */
106