]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/staging/bcm/CmHost.c
b54ec974477fbe46cc1cb974dec213f7bf43bdc0
[karo-tx-linux.git] / drivers / staging / bcm / CmHost.c
1 /************************************************************
2  * CMHOST.C
3  * This file contains the routines for handling Connection
4  * Management.
5  ************************************************************/
6
7 #include "headers.h"
8
9 enum E_CLASSIFIER_ACTION {
10         eInvalidClassifierAction,
11         eAddClassifier,
12         eReplaceClassifier,
13         eDeleteClassifier
14 };
15
16 static ULONG GetNextTargetBufferLocation(struct bcm_mini_adapter *Adapter, B_UINT16 tid);
17
18 /************************************************************
19  * Function - SearchSfid
20  *
21  * Description - This routinue would search QOS queues having
22  *  specified SFID as input parameter.
23  *
24  * Parameters - Adapter: Pointer to the Adapter structure
25  *  uiSfid : Given SFID for matching
26  *
27  * Returns - Queue index for this SFID(If matched)
28  *  Else Invalid Queue Index(If Not matched)
29  ************************************************************/
30 int SearchSfid(struct bcm_mini_adapter *Adapter, UINT uiSfid)
31 {
32         int i;
33
34         for (i = (NO_OF_QUEUES-1); i >= 0; i--)
35                 if (Adapter->PackInfo[i].ulSFID == uiSfid)
36                         return i;
37
38         return NO_OF_QUEUES+1;
39 }
40
41 /***************************************************************
42  * Function -SearchFreeSfid
43  *
44  * Description - This routinue would search Free available SFID.
45  *
46  * Parameter - Adapter: Pointer to the Adapter structure
47  *
48  * Returns - Queue index for the free SFID
49  *  Else returns Invalid Index.
50  ****************************************************************/
51 static int SearchFreeSfid(struct bcm_mini_adapter *Adapter)
52 {
53         int i;
54
55         for (i = 0; i < (NO_OF_QUEUES-1); i++)
56                 if (Adapter->PackInfo[i].ulSFID == 0)
57                         return i;
58
59         return NO_OF_QUEUES+1;
60 }
61
62 /*
63  * Function: SearchClsid
64  * Description: This routinue would search Classifier  having specified ClassifierID as input parameter
65  * Input parameters: struct bcm_mini_adapter *Adapter - Adapter Context
66  *  unsigned int uiSfid   - The SF in which the classifier is to searched
67  *  B_UINT16  uiClassifierID - The classifier ID to be searched
68  * Return: int :Classifier table index of matching entry
69  */
70 static int SearchClsid(struct bcm_mini_adapter *Adapter, ULONG ulSFID, B_UINT16  uiClassifierID)
71 {
72         int i;
73
74         for (i = 0; i < MAX_CLASSIFIERS; i++) {
75                 if ((Adapter->astClassifierTable[i].bUsed) &&
76                         (Adapter->astClassifierTable[i].uiClassifierRuleIndex == uiClassifierID) &&
77                         (Adapter->astClassifierTable[i].ulSFID == ulSFID))
78                         return i;
79         }
80
81         return MAX_CLASSIFIERS+1;
82 }
83
84 /*
85  * @ingroup ctrl_pkt_functions
86  * This routinue would search Free available Classifier entry in classifier table.
87  * @return free Classifier Entry index in classifier table for specified SF
88  */
89 static int SearchFreeClsid(struct bcm_mini_adapter *Adapter /**Adapter Context*/)
90 {
91         int i;
92
93         for (i = 0; i < MAX_CLASSIFIERS; i++) {
94                 if (!Adapter->astClassifierTable[i].bUsed)
95                         return i;
96         }
97
98         return MAX_CLASSIFIERS+1;
99 }
100
101 static VOID deleteSFBySfid(struct bcm_mini_adapter *Adapter, UINT uiSearchRuleIndex)
102 {
103         /* deleting all the packet held in the SF */
104         flush_queue(Adapter, uiSearchRuleIndex);
105
106         /* Deleting the all classifiers for this SF */
107         DeleteAllClassifiersForSF(Adapter, uiSearchRuleIndex);
108
109         /* Resetting only MIBS related entries in the SF */
110         memset((PVOID)&Adapter->PackInfo[uiSearchRuleIndex], 0, sizeof(S_MIBS_SERVICEFLOW_TABLE));
111 }
112
113 static inline VOID
114 CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry,
115                 B_UINT8 u8IpAddressLen, B_UINT8 *pu8IpAddressMaskSrc,
116                 BOOLEAN bIpVersion6, E_IPADDR_CONTEXT eIpAddrContext)
117 {
118         int i = 0;
119         UINT nSizeOfIPAddressInBytes = IP_LENGTH_OF_ADDRESS;
120         UCHAR *ptrClassifierIpAddress = NULL;
121         UCHAR *ptrClassifierIpMask = NULL;
122         struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
123
124         if (bIpVersion6)
125                 nSizeOfIPAddressInBytes = IPV6_ADDRESS_SIZEINBYTES;
126
127         /* Destination Ip Address */
128         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Ip Address Range Length:0x%X ", u8IpAddressLen);
129         if ((bIpVersion6 ? (IPV6_ADDRESS_SIZEINBYTES * MAX_IP_RANGE_LENGTH * 2) :
130                         (TOTAL_MASKED_ADDRESS_IN_BYTES)) >= u8IpAddressLen) {
131                 /*
132                  * checking both the mask and address togethor in Classification.
133                  * So length will be : TotalLengthInBytes/nSizeOfIPAddressInBytes * 2
134                  * (nSizeOfIPAddressInBytes for address and nSizeOfIPAddressInBytes for mask)
135                  */
136                 if (eIpAddrContext == eDestIpAddress) {
137                         pstClassifierEntry->ucIPDestinationAddressLength = u8IpAddressLen/(nSizeOfIPAddressInBytes * 2);
138                         if (bIpVersion6) {
139                                 ptrClassifierIpAddress = pstClassifierEntry->stDestIpAddress.ucIpv6Address;
140                                 ptrClassifierIpMask = pstClassifierEntry->stDestIpAddress.ucIpv6Mask;
141                         } else {
142                                 ptrClassifierIpAddress = pstClassifierEntry->stDestIpAddress.ucIpv4Address;
143                                 ptrClassifierIpMask = pstClassifierEntry->stDestIpAddress.ucIpv4Mask;
144                         }
145                 } else if (eIpAddrContext == eSrcIpAddress) {
146                         pstClassifierEntry->ucIPSourceAddressLength = u8IpAddressLen/(nSizeOfIPAddressInBytes * 2);
147                         if (bIpVersion6) {
148                                 ptrClassifierIpAddress = pstClassifierEntry->stSrcIpAddress.ucIpv6Address;
149                                 ptrClassifierIpMask = pstClassifierEntry->stSrcIpAddress.ucIpv6Mask;
150                         } else {
151                                 ptrClassifierIpAddress = pstClassifierEntry->stSrcIpAddress.ucIpv4Address;
152                                 ptrClassifierIpMask = pstClassifierEntry->stSrcIpAddress.ucIpv4Mask;
153                         }
154                 }
155                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Address Length:0x%X\n", pstClassifierEntry->ucIPDestinationAddressLength);
156                 while ((u8IpAddressLen >= nSizeOfIPAddressInBytes) && (i < MAX_IP_RANGE_LENGTH)) {
157                         memcpy(ptrClassifierIpAddress +
158                                 (i * nSizeOfIPAddressInBytes),
159                                 (pu8IpAddressMaskSrc+(i*nSizeOfIPAddressInBytes*2)),
160                                 nSizeOfIPAddressInBytes);
161
162                         if (!bIpVersion6) {
163                                 if (eIpAddrContext == eSrcIpAddress) {
164                                         pstClassifierEntry->stSrcIpAddress.ulIpv4Addr[i] = ntohl(pstClassifierEntry->stSrcIpAddress.ulIpv4Addr[i]);
165                                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Src Ip Address:0x%luX ",
166                                                         pstClassifierEntry->stSrcIpAddress.ulIpv4Addr[i]);
167                                 } else if (eIpAddrContext == eDestIpAddress) {
168                                         pstClassifierEntry->stDestIpAddress.ulIpv4Addr[i] = ntohl(pstClassifierEntry->stDestIpAddress.ulIpv4Addr[i]);
169                                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Dest Ip Address:0x%luX ",
170                                                         pstClassifierEntry->stDestIpAddress.ulIpv4Addr[i]);
171                                 }
172                         }
173                         u8IpAddressLen -= nSizeOfIPAddressInBytes;
174                         if (u8IpAddressLen >= nSizeOfIPAddressInBytes) {
175                                 memcpy(ptrClassifierIpMask +
176                                         (i * nSizeOfIPAddressInBytes),
177                                         (pu8IpAddressMaskSrc+nSizeOfIPAddressInBytes +
178                                                 (i*nSizeOfIPAddressInBytes*2)),
179                                         nSizeOfIPAddressInBytes);
180
181                                 if (!bIpVersion6) {
182                                         if (eIpAddrContext == eSrcIpAddress) {
183                                                 pstClassifierEntry->stSrcIpAddress.ulIpv4Mask[i] =
184                                                         ntohl(pstClassifierEntry->stSrcIpAddress.ulIpv4Mask[i]);
185                                                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Src Ip Mask Address:0x%luX ",
186                                                                 pstClassifierEntry->stSrcIpAddress.ulIpv4Mask[i]);
187                                         } else if (eIpAddrContext == eDestIpAddress) {
188                                                 pstClassifierEntry->stDestIpAddress.ulIpv4Mask[i] =
189                                                         ntohl(pstClassifierEntry->stDestIpAddress.ulIpv4Mask[i]);
190                                                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Dest Ip Mask Address:0x%luX ",
191                                                                 pstClassifierEntry->stDestIpAddress.ulIpv4Mask[i]);
192                                         }
193                                 }
194                                 u8IpAddressLen -= nSizeOfIPAddressInBytes;
195                         }
196                         if (u8IpAddressLen == 0)
197                                 pstClassifierEntry->bDestIpValid = TRUE;
198
199                         i++;
200                 }
201                 if (bIpVersion6) {
202                         /* Restore EndianNess of Struct */
203                         for (i = 0; i < MAX_IP_RANGE_LENGTH * 4; i++) {
204                                 if (eIpAddrContext == eSrcIpAddress) {
205                                         pstClassifierEntry->stSrcIpAddress.ulIpv6Addr[i] = ntohl(pstClassifierEntry->stSrcIpAddress.ulIpv6Addr[i]);
206                                         pstClassifierEntry->stSrcIpAddress.ulIpv6Mask[i] = ntohl(pstClassifierEntry->stSrcIpAddress.ulIpv6Mask[i]);
207                                 } else if (eIpAddrContext == eDestIpAddress) {
208                                         pstClassifierEntry->stDestIpAddress.ulIpv6Addr[i] = ntohl(pstClassifierEntry->stDestIpAddress.ulIpv6Addr[i]);
209                                         pstClassifierEntry->stDestIpAddress.ulIpv6Mask[i] = ntohl(pstClassifierEntry->stDestIpAddress.ulIpv6Mask[i]);
210                                 }
211                         }
212                 }
213         }
214 }
215
216 void ClearTargetDSXBuffer(struct bcm_mini_adapter *Adapter, B_UINT16 TID, BOOLEAN bFreeAll)
217 {
218         int i;
219
220         for (i = 0; i < Adapter->ulTotalTargetBuffersAvailable; i++) {
221                 if (Adapter->astTargetDsxBuffer[i].valid)
222                         continue;
223
224                 if ((bFreeAll) || (Adapter->astTargetDsxBuffer[i].tid == TID)) {
225                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "ClearTargetDSXBuffer: found tid %d buffer cleared %lx\n",
226                                         TID, Adapter->astTargetDsxBuffer[i].ulTargetDsxBuffer);
227                         Adapter->astTargetDsxBuffer[i].valid = 1;
228                         Adapter->astTargetDsxBuffer[i].tid = 0;
229                         Adapter->ulFreeTargetBufferCnt++;
230                 }
231         }
232 }
233
234 /*
235  * @ingroup ctrl_pkt_functions
236  * copy classifier rule into the specified SF index
237  */
238 static inline VOID CopyClassifierRuleToSF(struct bcm_mini_adapter *Adapter, stConvergenceSLTypes  *psfCSType, UINT uiSearchRuleIndex, UINT nClassifierIndex)
239 {
240         struct bcm_classifier_rule *pstClassifierEntry = NULL;
241         /* VOID *pvPhsContext = NULL; */
242         int i;
243         /* UCHAR ucProtocolLength=0; */
244         /* ULONG ulPhsStatus; */
245
246         if (Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value == 0 ||
247                 nClassifierIndex > (MAX_CLASSIFIERS-1))
248                 return;
249
250         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Storing Classifier Rule Index : %X",
251                         ntohs(psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex));
252
253         if (nClassifierIndex > MAX_CLASSIFIERS-1)
254                 return;
255
256         pstClassifierEntry = &Adapter->astClassifierTable[nClassifierIndex];
257         if (pstClassifierEntry) {
258                 /* Store if Ipv6 */
259                 pstClassifierEntry->bIpv6Protocol = (Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion == IPV6) ? TRUE : FALSE;
260
261                 /* Destinaiton Port */
262                 pstClassifierEntry->ucDestPortRangeLength = psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength / 4;
263                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Destination Port Range Length:0x%X ", pstClassifierEntry->ucDestPortRangeLength);
264
265                 if (psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength <= MAX_PORT_RANGE) {
266                         for (i = 0; i < (pstClassifierEntry->ucDestPortRangeLength); i++) {
267                                 pstClassifierEntry->usDestPortRangeLo[i] = *((PUSHORT)(psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange+i));
268                                 pstClassifierEntry->usDestPortRangeHi[i] =
269                                         *((PUSHORT)(psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange+2+i));
270                                 pstClassifierEntry->usDestPortRangeLo[i] = ntohs(pstClassifierEntry->usDestPortRangeLo[i]);
271                                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Destination Port Range Lo:0x%X ",
272                                                 pstClassifierEntry->usDestPortRangeLo[i]);
273                                 pstClassifierEntry->usDestPortRangeHi[i] = ntohs(pstClassifierEntry->usDestPortRangeHi[i]);
274                         }
275                 } else {
276                         pstClassifierEntry->ucDestPortRangeLength = 0;
277                 }
278
279                 /* Source Port */
280                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Source Port Range Length:0x%X ",
281                                 psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength);
282                 if (psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength <= MAX_PORT_RANGE) {
283                         pstClassifierEntry->ucSrcPortRangeLength = psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength/4;
284                         for (i = 0; i < (pstClassifierEntry->ucSrcPortRangeLength); i++) {
285                                 pstClassifierEntry->usSrcPortRangeLo[i] =
286                                         *((PUSHORT)(psfCSType->cCPacketClassificationRule.
287                                                         u8ProtocolSourcePortRange+i));
288                                 pstClassifierEntry->usSrcPortRangeHi[i] =
289                                         *((PUSHORT)(psfCSType->cCPacketClassificationRule.
290                                                         u8ProtocolSourcePortRange+2+i));
291                                 pstClassifierEntry->usSrcPortRangeLo[i] =
292                                         ntohs(pstClassifierEntry->usSrcPortRangeLo[i]);
293                                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Source Port Range Lo:0x%X ",
294                                                 pstClassifierEntry->usSrcPortRangeLo[i]);
295                                 pstClassifierEntry->usSrcPortRangeHi[i] = ntohs(pstClassifierEntry->usSrcPortRangeHi[i]);
296                         }
297                 }
298                 /* Destination Ip Address and Mask */
299                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Ip Destination Parameters : ");
300                 CopyIpAddrToClassifier(pstClassifierEntry,
301                                 psfCSType->cCPacketClassificationRule.u8IPDestinationAddressLength,
302                                 psfCSType->cCPacketClassificationRule.u8IPDestinationAddress,
303                                 (Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion == IPV6) ?
304                         TRUE : FALSE, eDestIpAddress);
305
306                 /* Source Ip Address and Mask */
307                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Ip Source Parameters : ");
308
309                 CopyIpAddrToClassifier(pstClassifierEntry,
310                                 psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddressLength,
311                                 psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddress,
312                                 (Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion == IPV6) ? TRUE : FALSE,
313                                 eSrcIpAddress);
314
315                 /* TOS */
316                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "TOS Length:0x%X ", psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength);
317                 if (psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength == 3) {
318                         pstClassifierEntry->ucIPTypeOfServiceLength = psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength;
319                         pstClassifierEntry->ucTosLow = psfCSType->cCPacketClassificationRule.u8IPTypeOfService[0];
320                         pstClassifierEntry->ucTosHigh = psfCSType->cCPacketClassificationRule.u8IPTypeOfService[1];
321                         pstClassifierEntry->ucTosMask = psfCSType->cCPacketClassificationRule.u8IPTypeOfService[2];
322                         pstClassifierEntry->bTOSValid = TRUE;
323                 }
324                 if (psfCSType->cCPacketClassificationRule.u8Protocol == 0) {
325                         /* we didn't get protocol field filled in by the BS */
326                         pstClassifierEntry->ucProtocolLength = 0;
327                 } else {
328                         pstClassifierEntry->ucProtocolLength = 1; /* 1 valid protocol */
329                 }
330
331                 pstClassifierEntry->ucProtocol[0] = psfCSType->cCPacketClassificationRule.u8Protocol;
332                 pstClassifierEntry->u8ClassifierRulePriority = psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority;
333
334                 /* store the classifier rule ID and set this classifier entry as valid */
335                 pstClassifierEntry->ucDirection = Adapter->PackInfo[uiSearchRuleIndex].ucDirection;
336                 pstClassifierEntry->uiClassifierRuleIndex = ntohs(psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex);
337                 pstClassifierEntry->usVCID_Value = Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value;
338                 pstClassifierEntry->ulSFID = Adapter->PackInfo[uiSearchRuleIndex].ulSFID;
339                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Search Index %d Dir: %d, Index: %d, Vcid: %d\n",
340                                 uiSearchRuleIndex, pstClassifierEntry->ucDirection,
341                                 pstClassifierEntry->uiClassifierRuleIndex,
342                                 pstClassifierEntry->usVCID_Value);
343
344                 if (psfCSType->cCPacketClassificationRule.u8AssociatedPHSI)
345                         pstClassifierEntry->u8AssociatedPHSI = psfCSType->cCPacketClassificationRule.u8AssociatedPHSI;
346
347                 /* Copy ETH CS Parameters */
348                 pstClassifierEntry->ucEthCSSrcMACLen = (psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddressLength);
349                 memcpy(pstClassifierEntry->au8EThCSSrcMAC, psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress, MAC_ADDRESS_SIZE);
350                 memcpy(pstClassifierEntry->au8EThCSSrcMACMask, psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress + MAC_ADDRESS_SIZE, MAC_ADDRESS_SIZE);
351                 pstClassifierEntry->ucEthCSDestMACLen = (psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
352                 memcpy(pstClassifierEntry->au8EThCSDestMAC, psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress, MAC_ADDRESS_SIZE);
353                 memcpy(pstClassifierEntry->au8EThCSDestMACMask, psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress + MAC_ADDRESS_SIZE, MAC_ADDRESS_SIZE);
354                 pstClassifierEntry->ucEtherTypeLen = (psfCSType->cCPacketClassificationRule.u8EthertypeLength);
355                 memcpy(pstClassifierEntry->au8EthCSEtherType, psfCSType->cCPacketClassificationRule.u8Ethertype, NUM_ETHERTYPE_BYTES);
356                 memcpy(pstClassifierEntry->usUserPriority, &psfCSType->cCPacketClassificationRule.u16UserPriority, 2);
357                 pstClassifierEntry->usVLANID = ntohs(psfCSType->cCPacketClassificationRule.u16VLANID);
358                 pstClassifierEntry->usValidityBitMap = ntohs(psfCSType->cCPacketClassificationRule.u16ValidityBitMap);
359
360                 pstClassifierEntry->bUsed = TRUE;
361         }
362 }
363
364 /*
365  * @ingroup ctrl_pkt_functions
366  */
367 static inline VOID DeleteClassifierRuleFromSF(struct bcm_mini_adapter *Adapter, UINT uiSearchRuleIndex, UINT nClassifierIndex)
368 {
369         struct bcm_classifier_rule *pstClassifierEntry = NULL;
370         B_UINT16 u16PacketClassificationRuleIndex;
371         USHORT usVCID;
372         /* VOID *pvPhsContext = NULL; */
373         /*ULONG ulPhsStatus; */
374
375         usVCID = Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value;
376
377         if (nClassifierIndex > MAX_CLASSIFIERS-1)
378                 return;
379
380         if (usVCID == 0)
381                 return;
382
383         u16PacketClassificationRuleIndex = Adapter->astClassifierTable[nClassifierIndex].uiClassifierRuleIndex;
384         pstClassifierEntry = &Adapter->astClassifierTable[nClassifierIndex];
385         if (pstClassifierEntry) {
386                 pstClassifierEntry->bUsed = FALSE;
387                 pstClassifierEntry->uiClassifierRuleIndex = 0;
388                 memset(pstClassifierEntry, 0, sizeof(struct bcm_classifier_rule));
389
390                 /* Delete the PHS Rule for this classifier */
391                 PhsDeleteClassifierRule(&Adapter->stBCMPhsContext, usVCID, u16PacketClassificationRuleIndex);
392         }
393 }
394
395 /*
396  * @ingroup ctrl_pkt_functions
397  */
398 VOID DeleteAllClassifiersForSF(struct bcm_mini_adapter *Adapter, UINT uiSearchRuleIndex)
399 {
400         struct bcm_classifier_rule *pstClassifierEntry = NULL;
401         int i;
402         /* B_UINT16  u16PacketClassificationRuleIndex; */
403         USHORT ulVCID;
404         /* VOID *pvPhsContext = NULL; */
405         /* ULONG ulPhsStatus; */
406
407         ulVCID = Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value;
408
409         if (ulVCID == 0)
410                 return;
411
412         for (i = 0; i < MAX_CLASSIFIERS; i++) {
413                 if (Adapter->astClassifierTable[i].usVCID_Value == ulVCID) {
414                         pstClassifierEntry = &Adapter->astClassifierTable[i];
415
416                         if (pstClassifierEntry->bUsed)
417                                 DeleteClassifierRuleFromSF(Adapter, uiSearchRuleIndex, i);
418                 }
419         }
420
421         /* Delete All Phs Rules Associated with this SF */
422         PhsDeleteSFRules(&Adapter->stBCMPhsContext, ulVCID);
423 }
424
425 /*
426  * This routinue  copies the Connection Management
427  * related data into the Adapter structure.
428  * @ingroup ctrl_pkt_functions
429  */
430 static VOID CopyToAdapter(register struct bcm_mini_adapter *Adapter, /* <Pointer to the Adapter structure */
431                         register pstServiceFlowParamSI psfLocalSet, /* <Pointer to the ServiceFlowParamSI structure */
432                         register UINT uiSearchRuleIndex, /* <Index of Queue, to which this data belongs */
433                         register UCHAR ucDsxType,
434                         stLocalSFAddIndicationAlt *pstAddIndication) {
435
436         /* UCHAR ucProtocolLength = 0; */
437         ULONG ulSFID;
438         UINT nClassifierIndex = 0;
439         enum E_CLASSIFIER_ACTION eClassifierAction = eInvalidClassifierAction;
440         B_UINT16 u16PacketClassificationRuleIndex = 0;
441         int i;
442         stConvergenceSLTypes *psfCSType = NULL;
443         S_PHS_RULE sPhsRule;
444         USHORT uVCID = Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value;
445         UINT UGIValue = 0;
446
447         Adapter->PackInfo[uiSearchRuleIndex].bValid = TRUE;
448         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Search Rule Index = %d\n", uiSearchRuleIndex);
449         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "%s: SFID= %x ", __func__, ntohl(psfLocalSet->u32SFID));
450         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Updating Queue %d", uiSearchRuleIndex);
451
452         ulSFID = ntohl(psfLocalSet->u32SFID);
453         /* Store IP Version used */
454         /* Get The Version Of IP used (IPv6 or IPv4) from CSSpecification field of SF */
455
456         Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = 0;
457         Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = 0;
458
459         /* Enable IP/ETh CS Support As Required */
460         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "CopyToAdapter : u8CSSpecification : %X\n", psfLocalSet->u8CSSpecification);
461         switch (psfLocalSet->u8CSSpecification) {
462         case eCSPacketIPV4:
463         {
464                 Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS;
465                 break;
466         }
467         case eCSPacketIPV6:
468         {
469                 Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV6_CS;
470                 break;
471         }
472         case eCS802_3PacketEthernet:
473         case eCS802_1QPacketVLAN:
474         {
475                 Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = ETH_CS_802_3;
476                 break;
477         }
478         case eCSPacketIPV4Over802_1QVLAN:
479         case eCSPacketIPV4Over802_3Ethernet:
480         {
481                 Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS;
482                 Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = ETH_CS_802_3;
483                 break;
484         }
485         case eCSPacketIPV6Over802_1QVLAN:
486         case eCSPacketIPV6Over802_3Ethernet:
487         {
488                 Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV6_CS;
489                 Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = ETH_CS_802_3;
490                 break;
491         }
492         default:
493         {
494                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Error in value of CS Classification.. setting default to IP CS\n");
495                 Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS;
496                 break;
497         }
498         }
499
500         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "CopyToAdapter : Queue No : %X ETH CS Support :  %X  , IP CS Support : %X\n",
501                         uiSearchRuleIndex,
502                         Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport,
503                         Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport);
504
505         /* Store IP Version used */
506         /* Get The Version Of IP used (IPv6 or IPv4) from CSSpecification field of SF */
507         if (Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport == IPV6_CS)
508                 Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion = IPV6;
509         else
510                 Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion = IPV4;
511
512         /* To ensure that the ETH CS code doesn't gets executed if the BS doesn't supports ETH CS */
513         if (!Adapter->bETHCSEnabled)
514                 Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = 0;
515
516         if (psfLocalSet->u8ServiceClassNameLength > 0 && psfLocalSet->u8ServiceClassNameLength < 32)
517                 memcpy(Adapter->PackInfo[uiSearchRuleIndex].ucServiceClassName, psfLocalSet->u8ServiceClassName, psfLocalSet->u8ServiceClassNameLength);
518
519         Adapter->PackInfo[uiSearchRuleIndex].u8QueueType = psfLocalSet->u8ServiceFlowSchedulingType;
520
521         if (Adapter->PackInfo[uiSearchRuleIndex].u8QueueType == BE && Adapter->PackInfo[uiSearchRuleIndex].ucDirection)
522                 Adapter->usBestEffortQueueIndex = uiSearchRuleIndex;
523
524         Adapter->PackInfo[uiSearchRuleIndex].ulSFID = ntohl(psfLocalSet->u32SFID);
525
526         Adapter->PackInfo[uiSearchRuleIndex].u8TrafficPriority = psfLocalSet->u8TrafficPriority;
527
528         /* copy all the classifier in the Service Flow param  structure */
529         for (i = 0; i < psfLocalSet->u8TotalClassifiers; i++) {
530                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Classifier index =%d", i);
531                 psfCSType = &psfLocalSet->cConvergenceSLTypes[i];
532                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Classifier index =%d", i);
533
534                 if (psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority)
535                         Adapter->PackInfo[uiSearchRuleIndex].bClassifierPriority = TRUE;
536
537                 if (psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority)
538                         Adapter->PackInfo[uiSearchRuleIndex].bClassifierPriority = TRUE;
539
540                 if (ucDsxType == DSA_ACK) {
541                         eClassifierAction = eAddClassifier;
542                 } else if (ucDsxType == DSC_ACK) {
543                         switch (psfCSType->u8ClassfierDSCAction) {
544                         case 0: /* DSC Add Classifier */
545                         {
546                                 eClassifierAction = eAddClassifier;
547                         }
548                         break;
549                         case 1: /* DSC Replace Classifier */
550                         {
551                                 eClassifierAction = eReplaceClassifier;
552                         }
553                         break;
554                         case 2: /* DSC Delete Classifier */
555                         {
556                                 eClassifierAction = eDeleteClassifier;
557                         }
558                         break;
559                         default:
560                         {
561                                 eClassifierAction = eInvalidClassifierAction;
562                         }
563                         }
564                 }
565
566                 u16PacketClassificationRuleIndex = ntohs(psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex);
567
568                 switch (eClassifierAction) {
569                 case eAddClassifier:
570                 {
571                         /* Get a Free Classifier Index From Classifier table for this SF to add the Classifier */
572                         /* Contained in this message */
573                         nClassifierIndex = SearchClsid(Adapter, ulSFID, u16PacketClassificationRuleIndex);
574
575                         if (nClassifierIndex > MAX_CLASSIFIERS) {
576                                 nClassifierIndex = SearchFreeClsid(Adapter);
577                                 if (nClassifierIndex > MAX_CLASSIFIERS) {
578                                         /* Failed To get a free Entry */
579                                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Error Failed To get a free Classifier Entry");
580                                         break;
581                                 }
582                                 /* Copy the Classifier Rule for this service flow into our Classifier table maintained per SF. */
583                                 CopyClassifierRuleToSF(Adapter, psfCSType, uiSearchRuleIndex, nClassifierIndex);
584                         } else {
585                                 /* This Classifier Already Exists and it is invalid to Add Classifier with existing PCRI */
586                                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,
587                                                 "CopyToAdapter: Error The Specified Classifier Already Exists and attempted To Add Classifier with Same PCRI : 0x%x\n",
588                                                 u16PacketClassificationRuleIndex);
589                         }
590                 }
591                 break;
592                 case eReplaceClassifier:
593                 {
594                         /* Get the Classifier Index From Classifier table for this SF and replace existing  Classifier */
595                         /* with the new classifier Contained in this message */
596                         nClassifierIndex = SearchClsid(Adapter, ulSFID, u16PacketClassificationRuleIndex);
597                         if (nClassifierIndex > MAX_CLASSIFIERS) {
598                                 /* Failed To search the classifier */
599                                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Error Search for Classifier To be replaced failed");
600                                 break;
601                         }
602                         /* Copy the Classifier Rule for this service flow into our Classifier table maintained per SF. */
603                         CopyClassifierRuleToSF(Adapter, psfCSType, uiSearchRuleIndex, nClassifierIndex);
604                 }
605                 break;
606                 case eDeleteClassifier:
607                 {
608                         /* Get the Classifier Index From Classifier table for this SF and replace existing  Classifier */
609                         /* with the new classifier Contained in this message */
610                         nClassifierIndex = SearchClsid(Adapter, ulSFID, u16PacketClassificationRuleIndex);
611                         if (nClassifierIndex > MAX_CLASSIFIERS) {
612                                 /* Failed To search the classifier */
613                                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Error Search for Classifier To be deleted failed");
614                                 break;
615                         }
616
617                         /* Delete This classifier */
618                         DeleteClassifierRuleFromSF(Adapter, uiSearchRuleIndex, nClassifierIndex);
619                 }
620                 break;
621                 default:
622                 {
623                         /* Invalid Action for classifier */
624                         break;
625                 }
626                 }
627         }
628
629         /* Repeat parsing Classification Entries to process PHS Rules */
630         for (i = 0; i < psfLocalSet->u8TotalClassifiers; i++) {
631                 psfCSType = &psfLocalSet->cConvergenceSLTypes[i];
632                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "psfCSType->u8PhsDSCAction : 0x%x\n", psfCSType->u8PhsDSCAction);
633
634                 switch (psfCSType->u8PhsDSCAction) {
635                 case eDeleteAllPHSRules:
636                 {
637                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Deleting All PHS Rules For VCID: 0x%X\n", uVCID);
638
639                         /* Delete All the PHS rules for this Service flow */
640                         PhsDeleteSFRules(&Adapter->stBCMPhsContext, uVCID);
641                         break;
642                 }
643                 case eDeletePHSRule:
644                 {
645                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "PHS DSC Action = Delete PHS Rule\n");
646
647                         if (psfCSType->cPhsRule.u8PHSI)
648                                 PhsDeletePHSRule(&Adapter->stBCMPhsContext, uVCID, psfCSType->cCPacketClassificationRule.u8AssociatedPHSI);
649
650                         break;
651                 }
652                 default:
653                 {
654                         if (ucDsxType == DSC_ACK) {
655                                 /* BCM_DEBUG_PRINT(CONN_MSG,("Invalid PHS DSC Action For DSC\n",psfCSType->cPhsRule.u8PHSI)); */
656                                 break; /* FOr DSC ACK Case PHS DSC Action must be in valid set */
657                         }
658                 }
659                 /* Proceed To Add PHS rule for DSA_ACK case even if PHS DSC action is unspecified */
660                 /* No Break Here . Intentionally! */
661
662                 case eAddPHSRule:
663                 case eSetPHSRule:
664                 {
665                         if (psfCSType->cPhsRule.u8PHSI) {
666                                 /* Apply This PHS Rule to all classifiers whose Associated PHSI Match */
667                                 unsigned int uiClassifierIndex = 0;
668                                 if (pstAddIndication->u8Direction == UPLINK_DIR) {
669                                         for (uiClassifierIndex = 0; uiClassifierIndex < MAX_CLASSIFIERS; uiClassifierIndex++) {
670                                                 if ((Adapter->astClassifierTable[uiClassifierIndex].bUsed) &&
671                                                         (Adapter->astClassifierTable[uiClassifierIndex].ulSFID == Adapter->PackInfo[uiSearchRuleIndex].ulSFID) &&
672                                                         (Adapter->astClassifierTable[uiClassifierIndex].u8AssociatedPHSI == psfCSType->cPhsRule.u8PHSI)) {
673                                                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,
674                                                                         "Adding PHS Rule For Classifier: 0x%x cPhsRule.u8PHSI: 0x%x\n",
675                                                                         Adapter->astClassifierTable[uiClassifierIndex].uiClassifierRuleIndex,
676                                                                         psfCSType->cPhsRule.u8PHSI);
677                                                         /* Update The PHS Rule for this classifier as Associated PHSI id defined */
678
679                                                         /* Copy the PHS Rule */
680                                                         sPhsRule.u8PHSI = psfCSType->cPhsRule.u8PHSI;
681                                                         sPhsRule.u8PHSFLength = psfCSType->cPhsRule.u8PHSFLength;
682                                                         sPhsRule.u8PHSMLength = psfCSType->cPhsRule.u8PHSMLength;
683                                                         sPhsRule.u8PHSS = psfCSType->cPhsRule.u8PHSS;
684                                                         sPhsRule.u8PHSV = psfCSType->cPhsRule.u8PHSV;
685                                                         memcpy(sPhsRule.u8PHSF, psfCSType->cPhsRule.u8PHSF, MAX_PHS_LENGTHS);
686                                                         memcpy(sPhsRule.u8PHSM, psfCSType->cPhsRule.u8PHSM, MAX_PHS_LENGTHS);
687                                                         sPhsRule.u8RefCnt = 0;
688                                                         sPhsRule.bUnclassifiedPHSRule = FALSE;
689                                                         sPhsRule.PHSModifiedBytes = 0;
690                                                         sPhsRule.PHSModifiedNumPackets = 0;
691                                                         sPhsRule.PHSErrorNumPackets = 0;
692
693                                                         /* bPHSRuleAssociated = TRUE; */
694                                                         /* Store The PHS Rule for this classifier */
695
696                                                         PhsUpdateClassifierRule(
697                                                                 &Adapter->stBCMPhsContext,
698                                                                 uVCID,
699                                                                 Adapter->astClassifierTable[uiClassifierIndex].uiClassifierRuleIndex,
700                                                                 &sPhsRule,
701                                                                 Adapter->astClassifierTable[uiClassifierIndex].u8AssociatedPHSI);
702
703                                                         /* Update PHS Rule For the Classifier */
704                                                         if (sPhsRule.u8PHSI) {
705                                                                 Adapter->astClassifierTable[uiClassifierIndex].u32PHSRuleID = sPhsRule.u8PHSI;
706                                                                 memcpy(&Adapter->astClassifierTable[uiClassifierIndex].sPhsRule, &sPhsRule, sizeof(S_PHS_RULE));
707                                                         }
708                                                 }
709                                         }
710                                 } else {
711                                         /* Error PHS Rule specified in signaling could not be applied to any classifier */
712
713                                         /* Copy the PHS Rule */
714                                         sPhsRule.u8PHSI = psfCSType->cPhsRule.u8PHSI;
715                                         sPhsRule.u8PHSFLength = psfCSType->cPhsRule.u8PHSFLength;
716                                         sPhsRule.u8PHSMLength = psfCSType->cPhsRule.u8PHSMLength;
717                                         sPhsRule.u8PHSS = psfCSType->cPhsRule.u8PHSS;
718                                         sPhsRule.u8PHSV = psfCSType->cPhsRule.u8PHSV;
719                                         memcpy(sPhsRule.u8PHSF, psfCSType->cPhsRule.u8PHSF, MAX_PHS_LENGTHS);
720                                         memcpy(sPhsRule.u8PHSM, psfCSType->cPhsRule.u8PHSM, MAX_PHS_LENGTHS);
721                                         sPhsRule.u8RefCnt = 0;
722                                         sPhsRule.bUnclassifiedPHSRule = TRUE;
723                                         sPhsRule.PHSModifiedBytes = 0;
724                                         sPhsRule.PHSModifiedNumPackets = 0;
725                                         sPhsRule.PHSErrorNumPackets = 0;
726                                         /* Store The PHS Rule for this classifier */
727
728                                         /*
729                                          * Passing the argument u8PHSI instead of clsid. Because for DL with no classifier rule,
730                                          * clsid will be zero hence we can't have multiple PHS rules for the same SF.
731                                          * To support multiple PHS rule, passing u8PHSI.
732                                          */
733                                         PhsUpdateClassifierRule(
734                                                 &Adapter->stBCMPhsContext,
735                                                 uVCID,
736                                                 sPhsRule.u8PHSI,
737                                                 &sPhsRule,
738                                                 sPhsRule.u8PHSI);
739                                 }
740                         }
741                 }
742                 break;
743                 }
744         }
745
746         if (psfLocalSet->u32MaxSustainedTrafficRate == 0) {
747                 /* No Rate Limit . Set Max Sustained Traffic Rate to Maximum */
748                 Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate = WIMAX_MAX_ALLOWED_RATE;
749         } else if (ntohl(psfLocalSet->u32MaxSustainedTrafficRate) > WIMAX_MAX_ALLOWED_RATE) {
750                 /* Too large Allowed Rate specified. Limiting to Wi Max  Allowed rate */
751                 Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate = WIMAX_MAX_ALLOWED_RATE;
752         } else {
753                 Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate =  ntohl(psfLocalSet->u32MaxSustainedTrafficRate);
754         }
755
756         Adapter->PackInfo[uiSearchRuleIndex].uiMaxLatency = ntohl(psfLocalSet->u32MaximumLatency);
757         if (Adapter->PackInfo[uiSearchRuleIndex].uiMaxLatency == 0) /* 0 should be treated as infinite */
758                 Adapter->PackInfo[uiSearchRuleIndex].uiMaxLatency = MAX_LATENCY_ALLOWED;
759
760         if ((Adapter->PackInfo[uiSearchRuleIndex].u8QueueType == ERTPS ||
761                         Adapter->PackInfo[uiSearchRuleIndex].u8QueueType == UGS))
762                 UGIValue = ntohs(psfLocalSet->u16UnsolicitedGrantInterval);
763
764         if (UGIValue == 0)
765                 UGIValue = DEFAULT_UG_INTERVAL;
766
767         /*
768          * For UGI based connections...
769          * DEFAULT_UGI_FACTOR*UGIInterval worth of data is the max token count at host...
770          * The extra amount of token is to ensure that a large amount of jitter won't have loss in throughput...
771          * In case of non-UGI based connection, 200 frames worth of data is the max token count at host...
772          */
773         Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize =
774                 (DEFAULT_UGI_FACTOR*Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate*UGIValue)/1000;
775
776         if (Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize < WIMAX_MAX_MTU*8) {
777                 UINT UGIFactor = 0;
778                 /* Special Handling to ensure the biggest size of packet can go out from host to FW as follows:
779                  * 1. Any packet from Host to FW can go out in different packet size.
780                  * 2. So in case the Bucket count is smaller than MTU, the packets of size (Size > TokenCount), will get dropped.
781                  * 3. We can allow packets of MaxSize from Host->FW that can go out from FW in multiple SDUs by fragmentation at Wimax Layer
782                  */
783                 UGIFactor = (Adapter->PackInfo[uiSearchRuleIndex].uiMaxLatency/UGIValue + 1);
784
785                 if (UGIFactor > DEFAULT_UGI_FACTOR)
786                         Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize =
787                                 (UGIFactor*Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate*UGIValue)/1000;
788
789                 if (Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize > WIMAX_MAX_MTU*8)
790                         Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize = WIMAX_MAX_MTU*8;
791         }
792
793         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "LAT: %d, UGI: %d\n", Adapter->PackInfo[uiSearchRuleIndex].uiMaxLatency, UGIValue);
794         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "uiMaxAllowedRate: 0x%x, u32MaxSustainedTrafficRate: 0x%x ,uiMaxBucketSize: 0x%x",
795                         Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate,
796                         ntohl(psfLocalSet->u32MaxSustainedTrafficRate),
797                         Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize);
798
799         /* copy the extended SF Parameters to Support MIBS */
800         CopyMIBSExtendedSFParameters(Adapter, psfLocalSet, uiSearchRuleIndex);
801
802         /* store header suppression enabled flag per SF */
803         Adapter->PackInfo[uiSearchRuleIndex].bHeaderSuppressionEnabled =
804                 !(psfLocalSet->u8RequesttransmissionPolicy &
805                         MASK_DISABLE_HEADER_SUPPRESSION);
806
807         kfree(Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication);
808         Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication = pstAddIndication;
809
810         /* Re Sort the SF list in PackInfo according to Traffic Priority */
811         SortPackInfo(Adapter);
812
813         /* Re Sort the Classifier Rules table and re - arrange
814          * according to Classifier Rule Priority
815          */
816         SortClassifiers(Adapter);
817         DumpPhsRules(&Adapter->stBCMPhsContext);
818         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "%s <=====", __func__);
819 }
820
821 /***********************************************************************
822  * Function - DumpCmControlPacket
823  *
824  * Description - This routinue Dumps the Contents of the AddIndication
825  *  Structure in the Connection Management Control Packet
826  *
827  * Parameter - pvBuffer: Pointer to the buffer containing the
828  *  AddIndication data.
829  *
830  * Returns - None
831  *************************************************************************/
832 static VOID DumpCmControlPacket(PVOID pvBuffer)
833 {
834         int uiLoopIndex;
835         int nIndex;
836         stLocalSFAddIndicationAlt *pstAddIndication;
837         UINT nCurClassifierCnt;
838         struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
839
840         pstAddIndication = (stLocalSFAddIndicationAlt *)pvBuffer;
841         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "======>");
842         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8Type: 0x%X", pstAddIndication->u8Type);
843         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8Direction: 0x%X", pstAddIndication->u8Direction);
844         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16TID: 0x%X", ntohs(pstAddIndication->u16TID));
845         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16CID: 0x%X", ntohs(pstAddIndication->u16CID));
846         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16VCID: 0x%X", ntohs(pstAddIndication->u16VCID));
847         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " AuthorizedSet--->");
848         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32SFID: 0x%X", htonl(pstAddIndication->sfAuthorizedSet.u32SFID));
849         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16CID: 0x%X", htons(pstAddIndication->sfAuthorizedSet.u16CID));
850         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ServiceClassNameLength: 0x%X",
851                         pstAddIndication->sfAuthorizedSet.u8ServiceClassNameLength);
852
853         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ServiceClassName: 0x%X ,0x%X , 0x%X, 0x%X, 0x%X, 0x%X",
854                         pstAddIndication->sfAuthorizedSet.u8ServiceClassName[0],
855                         pstAddIndication->sfAuthorizedSet.u8ServiceClassName[1],
856                         pstAddIndication->sfAuthorizedSet.u8ServiceClassName[2],
857                         pstAddIndication->sfAuthorizedSet.u8ServiceClassName[3],
858                         pstAddIndication->sfAuthorizedSet.u8ServiceClassName[4],
859                         pstAddIndication->sfAuthorizedSet.u8ServiceClassName[5]);
860
861         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8MBSService: 0x%X", pstAddIndication->sfAuthorizedSet.u8MBSService);
862         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8QosParamSet: 0x%X", pstAddIndication->sfAuthorizedSet.u8QosParamSet);
863         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8TrafficPriority: 0x%X, %p",
864                         pstAddIndication->sfAuthorizedSet.u8TrafficPriority, &pstAddIndication->sfAuthorizedSet.u8TrafficPriority);
865         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32MaxSustainedTrafficRate: 0x%X 0x%p",
866                         pstAddIndication->sfAuthorizedSet.u32MaxSustainedTrafficRate,
867                         &pstAddIndication->sfAuthorizedSet.u32MaxSustainedTrafficRate);
868         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32MaxTrafficBurst: 0x%X", pstAddIndication->sfAuthorizedSet.u32MaxTrafficBurst);
869         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32MinReservedTrafficRate : 0x%X",
870                         pstAddIndication->sfAuthorizedSet.u32MinReservedTrafficRate);
871         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8VendorSpecificQoSParamLength: 0x%X",
872                         pstAddIndication->sfAuthorizedSet.u8VendorSpecificQoSParamLength);
873         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8VendorSpecificQoSParam: 0x%X",
874                         pstAddIndication->sfAuthorizedSet.u8VendorSpecificQoSParam[0]);
875         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ServiceFlowSchedulingType: 0x%X",
876                         pstAddIndication->sfAuthorizedSet.u8ServiceFlowSchedulingType);
877         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32ToleratedJitter: 0x%X", pstAddIndication->sfAuthorizedSet.u32ToleratedJitter);
878         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32MaximumLatency: 0x%X", pstAddIndication->sfAuthorizedSet.u32MaximumLatency);
879         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8FixedLengthVSVariableLengthSDUIndicator: 0x%X",
880                         pstAddIndication->sfAuthorizedSet.u8FixedLengthVSVariableLengthSDUIndicator);
881         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8SDUSize: 0x%X", pstAddIndication->sfAuthorizedSet.u8SDUSize);
882         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16TargetSAID: 0x%X", pstAddIndication->sfAuthorizedSet.u16TargetSAID);
883         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ARQEnable: 0x%X", pstAddIndication->sfAuthorizedSet.u8ARQEnable);
884         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16ARQWindowSize: 0x%X", pstAddIndication->sfAuthorizedSet.u16ARQWindowSize);
885         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16ARQRetryTxTimeOut: 0x%X", pstAddIndication->sfAuthorizedSet.u16ARQRetryTxTimeOut);
886         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16ARQRetryRxTimeOut: 0x%X", pstAddIndication->sfAuthorizedSet.u16ARQRetryRxTimeOut);
887         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16ARQBlockLifeTime: 0x%X", pstAddIndication->sfAuthorizedSet.u16ARQBlockLifeTime);
888         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16ARQSyncLossTimeOut: 0x%X", pstAddIndication->sfAuthorizedSet.u16ARQSyncLossTimeOut);
889         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ARQDeliverInOrder: 0x%X", pstAddIndication->sfAuthorizedSet.u8ARQDeliverInOrder);
890         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16ARQRxPurgeTimeOut: 0x%X", pstAddIndication->sfAuthorizedSet.u16ARQRxPurgeTimeOut);
891         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16ARQBlockSize: 0x%X", pstAddIndication->sfAuthorizedSet.u16ARQBlockSize);
892         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8CSSpecification: 0x%X", pstAddIndication->sfAuthorizedSet.u8CSSpecification);
893         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8TypeOfDataDeliveryService: 0x%X",
894                         pstAddIndication->sfAuthorizedSet.u8TypeOfDataDeliveryService);
895         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16SDUInterArrivalTime: 0x%X", pstAddIndication->sfAuthorizedSet.u16SDUInterArrivalTime);
896         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16TimeBase: 0x%X", pstAddIndication->sfAuthorizedSet.u16TimeBase);
897         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8PagingPreference: 0x%X", pstAddIndication->sfAuthorizedSet.u8PagingPreference);
898         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16UnsolicitedPollingInterval: 0x%X",
899                         pstAddIndication->sfAuthorizedSet.u16UnsolicitedPollingInterval);
900
901         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "sfAuthorizedSet.u8HARQChannelMapping %x  %x %x ",
902                         *(unsigned int *)pstAddIndication->sfAuthorizedSet.u8HARQChannelMapping,
903                         *(unsigned int *)&pstAddIndication->sfAuthorizedSet.u8HARQChannelMapping[4],
904                         *(USHORT *)&pstAddIndication->sfAuthorizedSet.u8HARQChannelMapping[8]);
905         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8TrafficIndicationPreference: 0x%X",
906                         pstAddIndication->sfAuthorizedSet.u8TrafficIndicationPreference);
907         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " Total Classifiers Received: 0x%X", pstAddIndication->sfAuthorizedSet.u8TotalClassifiers);
908
909         nCurClassifierCnt = pstAddIndication->sfAuthorizedSet.u8TotalClassifiers;
910         if (nCurClassifierCnt > MAX_CLASSIFIERS_IN_SF)
911                 nCurClassifierCnt = MAX_CLASSIFIERS_IN_SF;
912
913         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "pstAddIndication->sfAuthorizedSet.bValid %d", pstAddIndication->sfAuthorizedSet.bValid);
914         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "pstAddIndication->sfAuthorizedSet.u16MacOverhead %x", pstAddIndication->sfAuthorizedSet.u16MacOverhead);
915         if (!pstAddIndication->sfAuthorizedSet.bValid)
916                 pstAddIndication->sfAuthorizedSet.bValid = 1;
917         for (nIndex = 0; nIndex < nCurClassifierCnt; nIndex++) {
918                 stConvergenceSLTypes *psfCSType = NULL;
919                 psfCSType =  &pstAddIndication->sfAuthorizedSet.cConvergenceSLTypes[nIndex];
920
921                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "psfCSType = %p", psfCSType);
922                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "CCPacketClassificationRuleSI====>");
923                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ClassifierRulePriority: 0x%X ",
924                                 psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority);
925                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPTypeOfServiceLength: 0x%X ",
926                                 psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength);
927                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPTypeOfService[3]: 0x%X ,0x%X ,0x%X ",
928                                 psfCSType->cCPacketClassificationRule.u8IPTypeOfService[0],
929                                 psfCSType->cCPacketClassificationRule.u8IPTypeOfService[1],
930                                 psfCSType->cCPacketClassificationRule.u8IPTypeOfService[2]);
931
932                 for (uiLoopIndex = 0; uiLoopIndex < 1; uiLoopIndex++)
933                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8Protocol: 0x%02X ",
934                                         psfCSType->cCPacketClassificationRule.u8Protocol);
935
936                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPMaskedSourceAddressLength: 0x%X ",
937                                 psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddressLength);
938
939                 for (uiLoopIndex = 0; uiLoopIndex < 32; uiLoopIndex++)
940                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPMaskedSourceAddress[32]: 0x%02X ",
941                                         psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddress[uiLoopIndex]);
942
943                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPDestinationAddressLength: 0x%X ",
944                                 psfCSType->cCPacketClassificationRule.u8IPDestinationAddressLength);
945
946                 for (uiLoopIndex = 0; uiLoopIndex < 32; uiLoopIndex++)
947                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPDestinationAddress[32]: 0x%02X ",
948                                         psfCSType->cCPacketClassificationRule.u8IPDestinationAddress[uiLoopIndex]);
949
950                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ProtocolSourcePortRangeLength:0x%X ",
951                                 psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength);
952                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ProtocolSourcePortRange[4]: 0x%02X ,0x%02X ,0x%02X ,0x%02X ",
953                                 psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[0],
954                                 psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[1],
955                                 psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[2],
956                                 psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[3]);
957
958                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ProtocolDestPortRangeLength: 0x%02X ",
959                                 psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength);
960                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ProtocolDestPortRange[4]: 0x%02X ,0x%02X ,0x%02X ,0x%02X ",
961                                 psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[0],
962                                 psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[1],
963                                 psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[2],
964                                 psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[3]);
965
966                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8EthernetDestMacAddressLength: 0x%02X ",
967                                 psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
968
969                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL,
970                                 DBG_LVL_ALL, "u8EthernetDestMacAddress[6]: %pM",
971                                 psfCSType->cCPacketClassificationRule.
972                                                 u8EthernetDestMacAddress);
973
974                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8EthernetSourceMACAddressLength: 0x%02X ",
975                                 psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
976
977                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL,
978                                 DBG_LVL_ALL, "u8EthernetSourceMACAddress[6]: "
979                                 "%pM", psfCSType->cCPacketClassificationRule.
980                                                 u8EthernetSourceMACAddress);
981
982                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8EthertypeLength: 0x%02X ",
983                                 psfCSType->cCPacketClassificationRule.u8EthertypeLength);
984                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8Ethertype[3]: 0x%02X ,0x%02X ,0x%02X ",
985                                 psfCSType->cCPacketClassificationRule.u8Ethertype[0],
986                                 psfCSType->cCPacketClassificationRule.u8Ethertype[1],
987                                 psfCSType->cCPacketClassificationRule.u8Ethertype[2]);
988
989                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16UserPriority: 0x%X ", psfCSType->cCPacketClassificationRule.u16UserPriority);
990                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16VLANID: 0x%X ", psfCSType->cCPacketClassificationRule.u16VLANID);
991                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8AssociatedPHSI: 0x%02X ", psfCSType->cCPacketClassificationRule.u8AssociatedPHSI);
992                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16PacketClassificationRuleIndex: 0x%X ",
993                                 psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex);
994
995                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8VendorSpecificClassifierParamLength: 0x%X ",
996                                 psfCSType->cCPacketClassificationRule.u8VendorSpecificClassifierParamLength);
997                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8VendorSpecificClassifierParam[1]: 0x%X ",
998                                 psfCSType->cCPacketClassificationRule.u8VendorSpecificClassifierParam[0]);
999 #ifdef VERSION_D5
1000                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPv6FlowLableLength: 0x%X ",
1001                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLableLength);
1002                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPv6FlowLable[6]: 0x %02X %02X %02X %02X %02X %02X ",
1003                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[0],
1004                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[1],
1005                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[2],
1006                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[3],
1007                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[4],
1008                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[5]);
1009 #endif
1010         }
1011
1012         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "bValid: 0x%02X", pstAddIndication->sfAuthorizedSet.bValid);
1013         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "AdmittedSet--->");
1014         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32SFID: 0x%X", pstAddIndication->sfAdmittedSet.u32SFID);
1015         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16CID: 0x%X", pstAddIndication->sfAdmittedSet.u16CID);
1016         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ServiceClassNameLength: 0x%X",
1017                         pstAddIndication->sfAdmittedSet.u8ServiceClassNameLength);
1018         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ServiceClassName: 0x %02X %02X %02X %02X %02X %02X",
1019                         pstAddIndication->sfAdmittedSet.u8ServiceClassName[0],
1020                         pstAddIndication->sfAdmittedSet.u8ServiceClassName[1],
1021                         pstAddIndication->sfAdmittedSet.u8ServiceClassName[2],
1022                         pstAddIndication->sfAdmittedSet.u8ServiceClassName[3],
1023                         pstAddIndication->sfAdmittedSet.u8ServiceClassName[4],
1024                         pstAddIndication->sfAdmittedSet.u8ServiceClassName[5]);
1025
1026         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8MBSService: 0x%02X", pstAddIndication->sfAdmittedSet.u8MBSService);
1027         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8QosParamSet: 0x%02X", pstAddIndication->sfAdmittedSet.u8QosParamSet);
1028         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8TrafficPriority: 0x%02X", pstAddIndication->sfAdmittedSet.u8TrafficPriority);
1029         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32MaxTrafficBurst: 0x%X", pstAddIndication->sfAdmittedSet.u32MaxTrafficBurst);
1030         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32MinReservedTrafficRate: 0x%X",
1031                         pstAddIndication->sfAdmittedSet.u32MinReservedTrafficRate);
1032
1033         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8VendorSpecificQoSParamLength: 0x%02X",
1034                         pstAddIndication->sfAdmittedSet.u8VendorSpecificQoSParamLength);
1035         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8VendorSpecificQoSParam: 0x%02X",
1036                         pstAddIndication->sfAdmittedSet.u8VendorSpecificQoSParam[0]);
1037         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ServiceFlowSchedulingType: 0x%02X",
1038                         pstAddIndication->sfAdmittedSet.u8ServiceFlowSchedulingType);
1039         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32ToleratedJitter: 0x%X", pstAddIndication->sfAdmittedSet.u32ToleratedJitter);
1040         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32MaximumLatency: 0x%X", pstAddIndication->sfAdmittedSet.u32MaximumLatency);
1041         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8FixedLengthVSVariableLengthSDUIndicator: 0x%02X",
1042                         pstAddIndication->sfAdmittedSet.u8FixedLengthVSVariableLengthSDUIndicator);
1043         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8SDUSize: 0x%02X", pstAddIndication->sfAdmittedSet.u8SDUSize);
1044         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16TargetSAID: 0x%02X", pstAddIndication->sfAdmittedSet.u16TargetSAID);
1045         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ARQEnable: 0x%02X", pstAddIndication->sfAdmittedSet.u8ARQEnable);
1046         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16ARQWindowSize: 0x%X", pstAddIndication->sfAdmittedSet.u16ARQWindowSize);
1047         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16ARQRetryTxTimeOut: 0x%X", pstAddIndication->sfAdmittedSet.u16ARQRetryTxTimeOut);
1048         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16ARQRetryRxTimeOut: 0x%X", pstAddIndication->sfAdmittedSet.u16ARQRetryRxTimeOut);
1049         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16ARQBlockLifeTime: 0x%X", pstAddIndication->sfAdmittedSet.u16ARQBlockLifeTime);
1050         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16ARQSyncLossTimeOut: 0x%X", pstAddIndication->sfAdmittedSet.u16ARQSyncLossTimeOut);
1051         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ARQDeliverInOrder: 0x%02X", pstAddIndication->sfAdmittedSet.u8ARQDeliverInOrder);
1052         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16ARQRxPurgeTimeOut: 0x%X", pstAddIndication->sfAdmittedSet.u16ARQRxPurgeTimeOut);
1053         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16ARQBlockSize: 0x%X", pstAddIndication->sfAdmittedSet.u16ARQBlockSize);
1054         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8CSSpecification: 0x%02X", pstAddIndication->sfAdmittedSet.u8CSSpecification);
1055         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8TypeOfDataDeliveryService: 0x%02X",
1056                         pstAddIndication->sfAdmittedSet.u8TypeOfDataDeliveryService);
1057         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16SDUInterArrivalTime: 0x%X", pstAddIndication->sfAdmittedSet.u16SDUInterArrivalTime);
1058         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16TimeBase: 0x%X", pstAddIndication->sfAdmittedSet.u16TimeBase);
1059         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8PagingPreference: 0x%X", pstAddIndication->sfAdmittedSet.u8PagingPreference);
1060         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8TrafficIndicationPreference: 0x%02X",
1061                         pstAddIndication->sfAdmittedSet.u8TrafficIndicationPreference);
1062         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " Total Classifiers Received: 0x%X", pstAddIndication->sfAdmittedSet.u8TotalClassifiers);
1063
1064         nCurClassifierCnt = pstAddIndication->sfAdmittedSet.u8TotalClassifiers;
1065         if (nCurClassifierCnt > MAX_CLASSIFIERS_IN_SF)
1066                 nCurClassifierCnt = MAX_CLASSIFIERS_IN_SF;
1067
1068         for (nIndex = 0; nIndex < nCurClassifierCnt; nIndex++) {
1069                 stConvergenceSLTypes *psfCSType = NULL;
1070
1071                 psfCSType =  &pstAddIndication->sfAdmittedSet.cConvergenceSLTypes[nIndex];
1072                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " CCPacketClassificationRuleSI====>");
1073                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ClassifierRulePriority: 0x%02X ",
1074                                 psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority);
1075                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPTypeOfServiceLength: 0x%02X",
1076                                 psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength);
1077                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPTypeOfService[3]: 0x%02X %02X %02X",
1078                                 psfCSType->cCPacketClassificationRule.u8IPTypeOfService[0],
1079                                 psfCSType->cCPacketClassificationRule.u8IPTypeOfService[1],
1080                                 psfCSType->cCPacketClassificationRule.u8IPTypeOfService[2]);
1081                 for (uiLoopIndex = 0; uiLoopIndex < 1; uiLoopIndex++)
1082                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8Protocol: 0x%02X ", psfCSType->cCPacketClassificationRule.u8Protocol);
1083
1084                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPMaskedSourceAddressLength: 0x%02X ",
1085                                 psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddressLength);
1086
1087                 for (uiLoopIndex = 0; uiLoopIndex < 32; uiLoopIndex++)
1088                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPMaskedSourceAddress[32]: 0x%02X ",
1089                                         psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddress[uiLoopIndex]);
1090
1091                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPDestinationAddressLength: 0x%02X ",
1092                                 psfCSType->cCPacketClassificationRule.u8IPDestinationAddressLength);
1093
1094                 for (uiLoopIndex = 0; uiLoopIndex < 32; uiLoopIndex++)
1095                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPDestinationAddress[32]: 0x%02X ",
1096                                         psfCSType->cCPacketClassificationRule.u8IPDestinationAddress[uiLoopIndex]);
1097
1098                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ProtocolSourcePortRangeLength: 0x%02X ",
1099                                 psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength);
1100
1101                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ProtocolSourcePortRange[4]: 0x %02X %02X %02X %02X ",
1102                                 psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[0],
1103                                 psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[1],
1104                                 psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[2],
1105                                 psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[3]);
1106
1107                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ProtocolDestPortRangeLength: 0x%02X ",
1108                                 psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength);
1109
1110                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ProtocolDestPortRange[4]: 0x %02X %02X %02X %02X ",
1111                                 psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[0],
1112                                 psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[1],
1113                                 psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[2],
1114                                 psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[3]);
1115
1116                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8EthernetDestMacAddressLength: 0x%02X ",
1117                                 psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
1118
1119                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL,
1120                                 DBG_LVL_ALL, "u8EthernetDestMacAddress[6]: %pM",
1121                                 psfCSType->cCPacketClassificationRule.
1122                                                 u8EthernetDestMacAddress);
1123
1124                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8EthernetSourceMACAddressLength: 0x%02X ",
1125                                 psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
1126
1127                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL,
1128                                 DBG_LVL_ALL, "u8EthernetSourceMACAddress[6]: "
1129                                 "%pM", psfCSType->cCPacketClassificationRule.
1130                                                 u8EthernetSourceMACAddress);
1131
1132                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8EthertypeLength: 0x%02X ", psfCSType->cCPacketClassificationRule.u8EthertypeLength);
1133                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8Ethertype[3]: 0x%02X %02X %02X",
1134                                 psfCSType->cCPacketClassificationRule.u8Ethertype[0],
1135                                 psfCSType->cCPacketClassificationRule.u8Ethertype[1],
1136                                 psfCSType->cCPacketClassificationRule.u8Ethertype[2]);
1137
1138                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16UserPriority: 0x%X ", psfCSType->cCPacketClassificationRule.u16UserPriority);
1139                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16VLANID: 0x%X ", psfCSType->cCPacketClassificationRule.u16VLANID);
1140                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8AssociatedPHSI: 0x%02X ", psfCSType->cCPacketClassificationRule.u8AssociatedPHSI);
1141                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16PacketClassificationRuleIndex: 0x%X ",
1142                                 psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex);
1143                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8VendorSpecificClassifierParamLength: 0x%02X",
1144                                 psfCSType->cCPacketClassificationRule.u8VendorSpecificClassifierParamLength);
1145                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8VendorSpecificClassifierParam[1]: 0x%02X ",
1146                                 psfCSType->cCPacketClassificationRule.u8VendorSpecificClassifierParam[0]);
1147 #ifdef VERSION_D5
1148                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPv6FlowLableLength: 0x%X ",
1149                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLableLength);
1150                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPv6FlowLable[6]: 0x %02X %02X %02X %02X %02X %02X ",
1151                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[0],
1152                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[1],
1153                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[2],
1154                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[3],
1155                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[4],
1156                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[5]);
1157 #endif
1158         }
1159
1160         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "bValid: 0x%X", pstAddIndication->sfAdmittedSet.bValid);
1161         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " ActiveSet--->");
1162         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32SFID: 0x%X", pstAddIndication->sfActiveSet.u32SFID);
1163         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16CID: 0x%X", pstAddIndication->sfActiveSet.u16CID);
1164         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ServiceClassNameLength: 0x%X", pstAddIndication->sfActiveSet.u8ServiceClassNameLength);
1165         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ServiceClassName: 0x %02X %02X %02X %02X %02X %02X",
1166                         pstAddIndication->sfActiveSet.u8ServiceClassName[0],
1167                         pstAddIndication->sfActiveSet.u8ServiceClassName[1],
1168                         pstAddIndication->sfActiveSet.u8ServiceClassName[2],
1169                         pstAddIndication->sfActiveSet.u8ServiceClassName[3],
1170                         pstAddIndication->sfActiveSet.u8ServiceClassName[4],
1171                         pstAddIndication->sfActiveSet.u8ServiceClassName[5]);
1172
1173         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8MBSService: 0x%02X", pstAddIndication->sfActiveSet.u8MBSService);
1174         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8QosParamSet: 0x%02X", pstAddIndication->sfActiveSet.u8QosParamSet);
1175         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8TrafficPriority: 0x%02X", pstAddIndication->sfActiveSet.u8TrafficPriority);
1176         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32MaxTrafficBurst: 0x%X", pstAddIndication->sfActiveSet.u32MaxTrafficBurst);
1177         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32MinReservedTrafficRate: 0x%X",
1178                         pstAddIndication->sfActiveSet.u32MinReservedTrafficRate);
1179         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8VendorSpecificQoSParamLength: 0x%02X",
1180                         pstAddIndication->sfActiveSet.u8VendorSpecificQoSParamLength);
1181         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8VendorSpecificQoSParam: 0x%02X",
1182                         pstAddIndication->sfActiveSet.u8VendorSpecificQoSParam[0]);
1183         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ServiceFlowSchedulingType: 0x%02X",
1184                         pstAddIndication->sfActiveSet.u8ServiceFlowSchedulingType);
1185         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32ToleratedJitter: 0x%X", pstAddIndication->sfActiveSet.u32ToleratedJitter);
1186         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32MaximumLatency: 0x%X", pstAddIndication->sfActiveSet.u32MaximumLatency);
1187         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8FixedLengthVSVariableLengthSDUIndicator: 0x%02X",
1188                         pstAddIndication->sfActiveSet.u8FixedLengthVSVariableLengthSDUIndicator);
1189         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8SDUSize: 0x%X", pstAddIndication->sfActiveSet.u8SDUSize);
1190         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u16TargetSAID: 0x%X", pstAddIndication->sfActiveSet.u16TargetSAID);
1191         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8ARQEnable: 0x%X", pstAddIndication->sfActiveSet.u8ARQEnable);
1192         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u16ARQWindowSize: 0x%X", pstAddIndication->sfActiveSet.u16ARQWindowSize);
1193         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u16ARQRetryTxTimeOut: 0x%X", pstAddIndication->sfActiveSet.u16ARQRetryTxTimeOut);
1194         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u16ARQRetryRxTimeOut: 0x%X", pstAddIndication->sfActiveSet.u16ARQRetryRxTimeOut);
1195         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u16ARQBlockLifeTime: 0x%X", pstAddIndication->sfActiveSet.u16ARQBlockLifeTime);
1196         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u16ARQSyncLossTimeOut: 0x%X", pstAddIndication->sfActiveSet.u16ARQSyncLossTimeOut);
1197         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8ARQDeliverInOrder: 0x%X", pstAddIndication->sfActiveSet.u8ARQDeliverInOrder);
1198         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u16ARQRxPurgeTimeOut: 0x%X", pstAddIndication->sfActiveSet.u16ARQRxPurgeTimeOut);
1199         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u16ARQBlockSize: 0x%X", pstAddIndication->sfActiveSet.u16ARQBlockSize);
1200         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8CSSpecification: 0x%X", pstAddIndication->sfActiveSet.u8CSSpecification);
1201         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8TypeOfDataDeliveryService: 0x%X",
1202                         pstAddIndication->sfActiveSet.u8TypeOfDataDeliveryService);
1203         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u16SDUInterArrivalTime: 0x%X", pstAddIndication->sfActiveSet.u16SDUInterArrivalTime);
1204         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u16TimeBase: 0x%X", pstAddIndication->sfActiveSet.u16TimeBase);
1205         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8PagingPreference: 0x%X", pstAddIndication->sfActiveSet.u8PagingPreference);
1206         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8TrafficIndicationPreference: 0x%X",
1207                         pstAddIndication->sfActiveSet.u8TrafficIndicationPreference);
1208         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " Total Classifiers Received: 0x%X", pstAddIndication->sfActiveSet.u8TotalClassifiers);
1209
1210         nCurClassifierCnt = pstAddIndication->sfActiveSet.u8TotalClassifiers;
1211         if (nCurClassifierCnt > MAX_CLASSIFIERS_IN_SF)
1212                 nCurClassifierCnt = MAX_CLASSIFIERS_IN_SF;
1213
1214         for (nIndex = 0; nIndex < nCurClassifierCnt; nIndex++)  {
1215                 stConvergenceSLTypes *psfCSType = NULL;
1216
1217                 psfCSType =  &pstAddIndication->sfActiveSet.cConvergenceSLTypes[nIndex];
1218                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " CCPacketClassificationRuleSI====>");
1219                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8ClassifierRulePriority: 0x%X ",
1220                                 psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority);
1221                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8IPTypeOfServiceLength: 0x%X ",
1222                                 psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength);
1223                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8IPTypeOfService[3]: 0x%X ,0x%X ,0x%X ",
1224                                 psfCSType->cCPacketClassificationRule.u8IPTypeOfService[0],
1225                                 psfCSType->cCPacketClassificationRule.u8IPTypeOfService[1],
1226                                 psfCSType->cCPacketClassificationRule.u8IPTypeOfService[2]);
1227
1228                 for (uiLoopIndex = 0; uiLoopIndex < 1; uiLoopIndex++)
1229                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8Protocol: 0x%X ", psfCSType->cCPacketClassificationRule.u8Protocol);
1230
1231                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPMaskedSourceAddressLength: 0x%X ",
1232                                 psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddressLength);
1233
1234                 for (uiLoopIndex = 0; uiLoopIndex < 32; uiLoopIndex++)
1235                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPMaskedSourceAddress[32]: 0x%X ",
1236                                         psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddress[uiLoopIndex]);
1237
1238                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPDestinationAddressLength: 0x%02X ",
1239                                 psfCSType->cCPacketClassificationRule.u8IPDestinationAddressLength);
1240
1241                 for (uiLoopIndex = 0; uiLoopIndex < 32; uiLoopIndex++)
1242                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8IPDestinationAddress[32]:0x%X ",
1243                                         psfCSType->cCPacketClassificationRule.u8IPDestinationAddress[uiLoopIndex]);
1244
1245                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8ProtocolSourcePortRangeLength: 0x%X ",
1246                                 psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength);
1247
1248                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8ProtocolSourcePortRange[4]: 0x%X ,0x%X ,0x%X ,0x%X ",
1249                                 psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[0],
1250                                 psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[1],
1251                                 psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[2],
1252                                 psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[3]);
1253
1254                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8ProtocolDestPortRangeLength: 0x%X ",
1255                                 psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength);
1256                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8ProtocolDestPortRange[4]: 0x%X ,0x%X ,0x%X ,0x%X ",
1257                                 psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[0],
1258                                 psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[1],
1259                                 psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[2],
1260                                 psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[3]);
1261
1262                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8EthernetDestMacAddressLength: 0x%X ",
1263                                 psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
1264                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8EthernetDestMacAddress[6]: 0x%X ,0x%X ,0x%X ,0x%X ,0x%X ,0x%X",
1265                                 psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[0],
1266                                 psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[1],
1267                                 psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[2],
1268                                 psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[3],
1269                                 psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[4],
1270                                 psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[5]);
1271
1272                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8EthernetSourceMACAddressLength: 0x%X ",
1273                                 psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
1274                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8EthernetSourceMACAddress[6]: 0x%X ,0x%X ,0x%X ,0x%X ,0x%X ,0x%X",
1275                                 psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[0],
1276                                 psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[1],
1277                                 psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[2],
1278                                 psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[3],
1279                                 psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[4],
1280                                 psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[5]);
1281
1282                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8EthertypeLength: 0x%X ",
1283                                 psfCSType->cCPacketClassificationRule.u8EthertypeLength);
1284                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8Ethertype[3]: 0x%X ,0x%X ,0x%X ",
1285                                 psfCSType->cCPacketClassificationRule.u8Ethertype[0],
1286                                 psfCSType->cCPacketClassificationRule.u8Ethertype[1],
1287                                 psfCSType->cCPacketClassificationRule.u8Ethertype[2]);
1288                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u16UserPriority: 0x%X ",
1289                                 psfCSType->cCPacketClassificationRule.u16UserPriority);
1290                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u16VLANID: 0x%X ", psfCSType->cCPacketClassificationRule.u16VLANID);
1291                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8AssociatedPHSI: 0x%X ", psfCSType->cCPacketClassificationRule.u8AssociatedPHSI);
1292                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u16PacketClassificationRuleIndex:0x%X ",
1293                                 psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex);
1294
1295                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8VendorSpecificClassifierParamLength:0x%X ",
1296                                 psfCSType->cCPacketClassificationRule.u8VendorSpecificClassifierParamLength);
1297                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8VendorSpecificClassifierParam[1]:0x%X ",
1298                                 psfCSType->cCPacketClassificationRule.u8VendorSpecificClassifierParam[0]);
1299 #ifdef VERSION_D5
1300                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8IPv6FlowLableLength: 0x%X ",
1301                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLableLength);
1302                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8IPv6FlowLable[6]: 0x%X ,0x%X ,0x%X ,0x%X ,0x%X ,0x%X ",
1303                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[0],
1304                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[1],
1305                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[2],
1306                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[3],
1307                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[4],
1308                                 psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[5]);
1309 #endif
1310         }
1311
1312         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " bValid: 0x%X", pstAddIndication->sfActiveSet.bValid);
1313 }
1314
1315 static inline ULONG RestoreSFParam(struct bcm_mini_adapter *Adapter, ULONG ulAddrSFParamSet, PUCHAR pucDestBuffer)
1316 {
1317         UINT  nBytesToRead = sizeof(stServiceFlowParamSI);
1318
1319         if (ulAddrSFParamSet == 0 || NULL == pucDestBuffer) {
1320                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Got Param address as 0!!");
1321                 return 0;
1322         }
1323         ulAddrSFParamSet = ntohl(ulAddrSFParamSet);
1324
1325         /* Read out the SF Param Set At the indicated Location */
1326         if (rdm(Adapter, ulAddrSFParamSet, (PUCHAR)pucDestBuffer, nBytesToRead) < 0)
1327                 return STATUS_FAILURE;
1328
1329         return 1;
1330 }
1331
1332 static ULONG StoreSFParam(struct bcm_mini_adapter *Adapter, PUCHAR pucSrcBuffer, ULONG ulAddrSFParamSet)
1333 {
1334         UINT nBytesToWrite = sizeof(stServiceFlowParamSI);
1335         int ret = 0;
1336
1337         if (ulAddrSFParamSet == 0 || NULL == pucSrcBuffer)
1338                 return 0;
1339
1340         ret = wrm(Adapter, ulAddrSFParamSet, (u8 *)pucSrcBuffer, nBytesToWrite);
1341         if (ret < 0) {
1342                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "%s:%d WRM failed", __func__, __LINE__);
1343                 return ret;
1344         }
1345         return 1;
1346 }
1347
1348 ULONG StoreCmControlResponseMessage(struct bcm_mini_adapter *Adapter, PVOID pvBuffer, UINT *puBufferLength)
1349 {
1350         stLocalSFAddIndicationAlt *pstAddIndicationAlt = NULL;
1351         stLocalSFAddIndication *pstAddIndication = NULL;
1352         stLocalSFDeleteRequest *pstDeletionRequest;
1353         UINT uiSearchRuleIndex;
1354         ULONG ulSFID;
1355
1356         pstAddIndicationAlt = (stLocalSFAddIndicationAlt *)(pvBuffer);
1357
1358         /*
1359          * In case of DSD Req By MS, we should immediately delete this SF so that
1360          * we can stop the further classifying the pkt for this SF.
1361          */
1362         if (pstAddIndicationAlt->u8Type == DSD_REQ) {
1363                 pstDeletionRequest = (stLocalSFDeleteRequest *)pvBuffer;
1364
1365                 ulSFID = ntohl(pstDeletionRequest->u32SFID);
1366                 uiSearchRuleIndex = SearchSfid(Adapter, ulSFID);
1367
1368                 if (uiSearchRuleIndex < NO_OF_QUEUES) {
1369                         deleteSFBySfid(Adapter, uiSearchRuleIndex);
1370                         Adapter->u32TotalDSD++;
1371                 }
1372                 return 1;
1373         }
1374
1375         if ((pstAddIndicationAlt->u8Type == DSD_RSP) ||
1376                 (pstAddIndicationAlt->u8Type == DSD_ACK)) {
1377                 /* No Special handling send the message as it is */
1378                 return 1;
1379         }
1380         /* For DSA_REQ, only up to "psfAuthorizedSet" parameter should be accessed by driver! */
1381
1382         pstAddIndication = kmalloc(sizeof(*pstAddIndication), GFP_KERNEL);
1383         if (pstAddIndication == NULL)
1384                 return 0;
1385
1386         /* AUTHORIZED SET */
1387         pstAddIndication->psfAuthorizedSet = (stServiceFlowParamSI *)
1388                         GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID);
1389         if (!pstAddIndication->psfAuthorizedSet) {
1390                 kfree(pstAddIndication);
1391                 return 0;
1392         }
1393
1394         if (StoreSFParam(Adapter, (PUCHAR)&pstAddIndicationAlt->sfAuthorizedSet,
1395                                 (ULONG)pstAddIndication->psfAuthorizedSet) != 1) {
1396                 kfree(pstAddIndication);
1397                 return 0;
1398         }
1399
1400         /* this can't possibly be right */
1401         pstAddIndication->psfAuthorizedSet = (stServiceFlowParamSI *)ntohl((ULONG)pstAddIndication->psfAuthorizedSet);
1402
1403         if (pstAddIndicationAlt->u8Type == DSA_REQ) {
1404                 stLocalSFAddRequest AddRequest;
1405
1406                 AddRequest.u8Type = pstAddIndicationAlt->u8Type;
1407                 AddRequest.eConnectionDir = pstAddIndicationAlt->u8Direction;
1408                 AddRequest.u16TID = pstAddIndicationAlt->u16TID;
1409                 AddRequest.u16CID = pstAddIndicationAlt->u16CID;
1410                 AddRequest.u16VCID = pstAddIndicationAlt->u16VCID;
1411                 AddRequest.psfParameterSet = pstAddIndication->psfAuthorizedSet;
1412                 (*puBufferLength) = sizeof(stLocalSFAddRequest);
1413                 memcpy(pvBuffer, &AddRequest, sizeof(stLocalSFAddRequest));
1414                 kfree(pstAddIndication);
1415                 return 1;
1416         }
1417
1418         /* Since it's not DSA_REQ, we can access all field in pstAddIndicationAlt */
1419         /* We need to extract the structure from the buffer and pack it differently */
1420
1421         pstAddIndication->u8Type = pstAddIndicationAlt->u8Type;
1422         pstAddIndication->eConnectionDir = pstAddIndicationAlt->u8Direction;
1423         pstAddIndication->u16TID = pstAddIndicationAlt->u16TID;
1424         pstAddIndication->u16CID = pstAddIndicationAlt->u16CID;
1425         pstAddIndication->u16VCID = pstAddIndicationAlt->u16VCID;
1426         pstAddIndication->u8CC = pstAddIndicationAlt->u8CC;
1427
1428         /* ADMITTED SET */
1429         pstAddIndication->psfAdmittedSet = (stServiceFlowParamSI *)
1430                 GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID);
1431         if (!pstAddIndication->psfAdmittedSet) {
1432                 kfree(pstAddIndication);
1433                 return 0;
1434         }
1435         if (StoreSFParam(Adapter, (PUCHAR)&pstAddIndicationAlt->sfAdmittedSet, (ULONG)pstAddIndication->psfAdmittedSet) != 1) {
1436                 kfree(pstAddIndication);
1437                 return 0;
1438         }
1439
1440         pstAddIndication->psfAdmittedSet = (stServiceFlowParamSI *)ntohl((ULONG)pstAddIndication->psfAdmittedSet);
1441
1442         /* ACTIVE SET */
1443         pstAddIndication->psfActiveSet = (stServiceFlowParamSI *)
1444                 GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID);
1445         if (!pstAddIndication->psfActiveSet) {
1446                 kfree(pstAddIndication);
1447                 return 0;
1448         }
1449         if (StoreSFParam(Adapter, (PUCHAR)&pstAddIndicationAlt->sfActiveSet, (ULONG)pstAddIndication->psfActiveSet) != 1) {
1450                 kfree(pstAddIndication);
1451                 return 0;
1452         }
1453
1454         pstAddIndication->psfActiveSet = (stServiceFlowParamSI *)ntohl((ULONG)pstAddIndication->psfActiveSet);
1455
1456         (*puBufferLength) = sizeof(stLocalSFAddIndication);
1457         *(stLocalSFAddIndication *)pvBuffer = *pstAddIndication;
1458         kfree(pstAddIndication);
1459         return 1;
1460 }
1461
1462 static inline stLocalSFAddIndicationAlt
1463 *RestoreCmControlResponseMessage(register struct bcm_mini_adapter *Adapter, register PVOID pvBuffer)
1464 {
1465         ULONG ulStatus = 0;
1466         stLocalSFAddIndication *pstAddIndication = NULL;
1467         stLocalSFAddIndicationAlt *pstAddIndicationDest = NULL;
1468
1469         pstAddIndication = (stLocalSFAddIndication *)(pvBuffer);
1470         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "=====>");
1471         if ((pstAddIndication->u8Type == DSD_REQ) ||
1472                 (pstAddIndication->u8Type == DSD_RSP) ||
1473                 (pstAddIndication->u8Type == DSD_ACK))
1474                 return (stLocalSFAddIndicationAlt *)pvBuffer;
1475
1476         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Inside RestoreCmControlResponseMessage ");
1477         /*
1478          * Need to Allocate memory to contain the SUPER Large structures
1479          * Our driver can't create these structures on Stack :(
1480          */
1481         pstAddIndicationDest = kmalloc(sizeof(stLocalSFAddIndicationAlt), GFP_KERNEL);
1482
1483         if (pstAddIndicationDest) {
1484                 memset(pstAddIndicationDest, 0, sizeof(stLocalSFAddIndicationAlt));
1485         } else {
1486                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Failed to allocate memory for SF Add Indication Structure ");
1487                 return NULL;
1488         }
1489         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-u8Type : 0x%X", pstAddIndication->u8Type);
1490         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-u8Direction : 0x%X", pstAddIndication->eConnectionDir);
1491         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-u8TID : 0x%X", ntohs(pstAddIndication->u16TID));
1492         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-u8CID : 0x%X", ntohs(pstAddIndication->u16CID));
1493         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-u16VCID : 0x%X", ntohs(pstAddIndication->u16VCID));
1494         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-autorized set loc : %p", pstAddIndication->psfAuthorizedSet);
1495         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-admitted set loc : %p", pstAddIndication->psfAdmittedSet);
1496         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-Active set loc : %p", pstAddIndication->psfActiveSet);
1497
1498         pstAddIndicationDest->u8Type = pstAddIndication->u8Type;
1499         pstAddIndicationDest->u8Direction = pstAddIndication->eConnectionDir;
1500         pstAddIndicationDest->u16TID = pstAddIndication->u16TID;
1501         pstAddIndicationDest->u16CID = pstAddIndication->u16CID;
1502         pstAddIndicationDest->u16VCID = pstAddIndication->u16VCID;
1503         pstAddIndicationDest->u8CC = pstAddIndication->u8CC;
1504
1505         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "Restoring Active Set ");
1506         ulStatus = RestoreSFParam(Adapter, (ULONG)pstAddIndication->psfActiveSet, (PUCHAR)&pstAddIndicationDest->sfActiveSet);
1507         if (ulStatus != 1)
1508                 goto failed_restore_sf_param;
1509
1510         if (pstAddIndicationDest->sfActiveSet.u8TotalClassifiers > MAX_CLASSIFIERS_IN_SF)
1511                 pstAddIndicationDest->sfActiveSet.u8TotalClassifiers = MAX_CLASSIFIERS_IN_SF;
1512
1513         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "Restoring Admitted Set ");
1514         ulStatus = RestoreSFParam(Adapter, (ULONG)pstAddIndication->psfAdmittedSet, (PUCHAR)&pstAddIndicationDest->sfAdmittedSet);
1515         if (ulStatus != 1)
1516                 goto failed_restore_sf_param;
1517
1518         if (pstAddIndicationDest->sfAdmittedSet.u8TotalClassifiers > MAX_CLASSIFIERS_IN_SF)
1519                 pstAddIndicationDest->sfAdmittedSet.u8TotalClassifiers = MAX_CLASSIFIERS_IN_SF;
1520
1521         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "Restoring Authorized Set ");
1522         ulStatus = RestoreSFParam(Adapter, (ULONG)pstAddIndication->psfAuthorizedSet, (PUCHAR)&pstAddIndicationDest->sfAuthorizedSet);
1523         if (ulStatus != 1)
1524                 goto failed_restore_sf_param;
1525
1526         if (pstAddIndicationDest->sfAuthorizedSet.u8TotalClassifiers > MAX_CLASSIFIERS_IN_SF)
1527                 pstAddIndicationDest->sfAuthorizedSet.u8TotalClassifiers = MAX_CLASSIFIERS_IN_SF;
1528
1529         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Dumping the whole raw packet");
1530         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "============================================================");
1531         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, " pstAddIndicationDest->sfActiveSet size  %zx %p", sizeof(*pstAddIndicationDest), pstAddIndicationDest);
1532         /* BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, (unsigned char *)pstAddIndicationDest, sizeof(*pstAddIndicationDest)); */
1533         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "============================================================");
1534         return pstAddIndicationDest;
1535 failed_restore_sf_param:
1536         kfree(pstAddIndicationDest);
1537         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<=====");
1538         return NULL;
1539 }
1540
1541 ULONG SetUpTargetDsxBuffers(struct bcm_mini_adapter *Adapter)
1542 {
1543         ULONG ulTargetDsxBuffersBase = 0;
1544         ULONG ulCntTargetBuffers;
1545         ULONG i;
1546         int Status;
1547
1548         if (!Adapter) {
1549                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Adapter was NULL!!!");
1550                 return 0;
1551         }
1552
1553         if (Adapter->astTargetDsxBuffer[0].ulTargetDsxBuffer)
1554                 return 1;
1555
1556         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Size of Each DSX Buffer(Also size of ServiceFlowParamSI): %zx ", sizeof(stServiceFlowParamSI));
1557         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Reading DSX buffer From Target location %x ", DSX_MESSAGE_EXCHANGE_BUFFER);
1558
1559         Status = rdmalt(Adapter, DSX_MESSAGE_EXCHANGE_BUFFER, (PUINT)&ulTargetDsxBuffersBase, sizeof(UINT));
1560         if (Status < 0) {
1561                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "RDM failed!!");
1562                 return 0;
1563         }
1564
1565         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Base Address Of DSX  Target Buffer : 0x%lx", ulTargetDsxBuffersBase);
1566         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "Tgt Buffer is Now %lx :", ulTargetDsxBuffersBase);
1567         ulCntTargetBuffers = DSX_MESSAGE_EXCHANGE_BUFFER_SIZE / sizeof(stServiceFlowParamSI);
1568
1569         Adapter->ulTotalTargetBuffersAvailable =
1570                 ulCntTargetBuffers > MAX_TARGET_DSX_BUFFERS ?
1571                 MAX_TARGET_DSX_BUFFERS : ulCntTargetBuffers;
1572
1573         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, " Total Target DSX Buffer setup %lx ", Adapter->ulTotalTargetBuffersAvailable);
1574
1575         for (i = 0; i < Adapter->ulTotalTargetBuffersAvailable; i++) {
1576                 Adapter->astTargetDsxBuffer[i].ulTargetDsxBuffer = ulTargetDsxBuffersBase;
1577                 Adapter->astTargetDsxBuffer[i].valid = 1;
1578                 Adapter->astTargetDsxBuffer[i].tid = 0;
1579                 ulTargetDsxBuffersBase += sizeof(stServiceFlowParamSI);
1580                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "  Target DSX Buffer %lx setup at 0x%lx",
1581                                 i, Adapter->astTargetDsxBuffer[i].ulTargetDsxBuffer);
1582         }
1583         Adapter->ulCurrentTargetBuffer = 0;
1584         Adapter->ulFreeTargetBufferCnt = Adapter->ulTotalTargetBuffersAvailable;
1585         return 1;
1586 }
1587
1588 static ULONG GetNextTargetBufferLocation(struct bcm_mini_adapter *Adapter, B_UINT16 tid)
1589 {
1590         ULONG ulTargetDSXBufferAddress;
1591         ULONG ulTargetDsxBufferIndexToUse, ulMaxTry;
1592
1593         if ((Adapter->ulTotalTargetBuffersAvailable == 0) || (Adapter->ulFreeTargetBufferCnt == 0)) {
1594                 ClearTargetDSXBuffer(Adapter, tid, FALSE);
1595                 return 0;
1596         }
1597
1598         ulTargetDsxBufferIndexToUse = Adapter->ulCurrentTargetBuffer;
1599         ulMaxTry = Adapter->ulTotalTargetBuffersAvailable;
1600         while ((ulMaxTry) && (Adapter->astTargetDsxBuffer[ulTargetDsxBufferIndexToUse].valid != 1)) {
1601                 ulTargetDsxBufferIndexToUse = (ulTargetDsxBufferIndexToUse+1) % Adapter->ulTotalTargetBuffersAvailable;
1602                 ulMaxTry--;
1603         }
1604
1605         if (ulMaxTry == 0) {
1606                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "\n GetNextTargetBufferLocation : Error No Free Target DSX Buffers FreeCnt : %lx ", Adapter->ulFreeTargetBufferCnt);
1607                 ClearTargetDSXBuffer(Adapter, tid, FALSE);
1608                 return 0;
1609         }
1610
1611         ulTargetDSXBufferAddress = Adapter->astTargetDsxBuffer[ulTargetDsxBufferIndexToUse].ulTargetDsxBuffer;
1612         Adapter->astTargetDsxBuffer[ulTargetDsxBufferIndexToUse].valid = 0;
1613         Adapter->astTargetDsxBuffer[ulTargetDsxBufferIndexToUse].tid = tid;
1614         Adapter->ulFreeTargetBufferCnt--;
1615         ulTargetDsxBufferIndexToUse = (ulTargetDsxBufferIndexToUse+1)%Adapter->ulTotalTargetBuffersAvailable;
1616         Adapter->ulCurrentTargetBuffer = ulTargetDsxBufferIndexToUse;
1617         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "GetNextTargetBufferLocation :Returning address %lx tid %d\n", ulTargetDSXBufferAddress, tid);
1618
1619         return ulTargetDSXBufferAddress;
1620 }
1621
1622 int AllocAdapterDsxBuffer(struct bcm_mini_adapter *Adapter)
1623 {
1624         /*
1625          * Need to Allocate memory to contain the SUPER Large structures
1626          * Our driver can't create these structures on Stack
1627          */
1628         Adapter->caDsxReqResp = kmalloc(sizeof(stLocalSFAddIndicationAlt)+LEADER_SIZE, GFP_KERNEL);
1629         if (!Adapter->caDsxReqResp)
1630                 return -ENOMEM;
1631
1632         return 0;
1633 }
1634
1635 int FreeAdapterDsxBuffer(struct bcm_mini_adapter *Adapter)
1636 {
1637         kfree(Adapter->caDsxReqResp);
1638         return 0;
1639 }
1640
1641 /*
1642  * @ingroup ctrl_pkt_functions
1643  * This routinue would process the Control responses
1644  * for the Connection Management.
1645  * @return - Queue index for the free SFID else returns Invalid Index.
1646  */
1647 BOOLEAN CmControlResponseMessage(struct bcm_mini_adapter *Adapter,  /* <Pointer to the Adapter structure */
1648                                 PVOID pvBuffer /* Starting Address of the Buffer, that contains the AddIndication Data */)
1649 {
1650         stServiceFlowParamSI *psfLocalSet = NULL;
1651         stLocalSFAddIndicationAlt *pstAddIndication = NULL;
1652         stLocalSFChangeIndicationAlt *pstChangeIndication = NULL;
1653         struct bcm_leader *pLeader = NULL;
1654
1655         /*
1656          * Otherwise the message contains a target address from where we need to
1657          * read out the rest of the service flow param structure
1658          */
1659         pstAddIndication = RestoreCmControlResponseMessage(Adapter, pvBuffer);
1660         if (pstAddIndication == NULL) {
1661                 ClearTargetDSXBuffer(Adapter, ((stLocalSFAddIndication *)pvBuffer)->u16TID, FALSE);
1662                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Error in restoring Service Flow param structure from DSx message");
1663                 return FALSE;
1664         }
1665
1666         DumpCmControlPacket(pstAddIndication);
1667         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "====>");
1668         pLeader = (struct bcm_leader *)Adapter->caDsxReqResp;
1669
1670         pLeader->Status = CM_CONTROL_NEWDSX_MULTICLASSIFIER_REQ;
1671         pLeader->Vcid = 0;
1672
1673         ClearTargetDSXBuffer(Adapter, pstAddIndication->u16TID, FALSE);
1674         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "### TID RECEIVED %d\n", pstAddIndication->u16TID);
1675         switch (pstAddIndication->u8Type) {
1676         case DSA_REQ:
1677         {
1678                 pLeader->PLength = sizeof(stLocalSFAddIndicationAlt);
1679                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Sending DSA Response....\n");
1680                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SENDING DSA RESPONSE TO MAC %d", pLeader->PLength);
1681                 *((stLocalSFAddIndicationAlt *)&(Adapter->caDsxReqResp[LEADER_SIZE]))
1682                         = *pstAddIndication;
1683                 ((stLocalSFAddIndicationAlt *)&(Adapter->caDsxReqResp[LEADER_SIZE]))->u8Type = DSA_RSP;
1684
1685                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, " VCID = %x", ntohs(pstAddIndication->u16VCID));
1686                 CopyBufferToControlPacket(Adapter, (PVOID)Adapter->caDsxReqResp);
1687                 kfree(pstAddIndication);
1688         }
1689         break;
1690         case DSA_RSP:
1691         {
1692                 pLeader->PLength = sizeof(stLocalSFAddIndicationAlt);
1693                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SENDING DSA ACK TO MAC %d",
1694                                 pLeader->PLength);
1695                 *((stLocalSFAddIndicationAlt *)&(Adapter->caDsxReqResp[LEADER_SIZE]))
1696                         = *pstAddIndication;
1697                 ((stLocalSFAddIndicationAlt *)&(Adapter->caDsxReqResp[LEADER_SIZE]))->u8Type = DSA_ACK;
1698
1699         } /* no break here..we should go down. */
1700         case DSA_ACK:
1701         {
1702                 UINT uiSearchRuleIndex = 0;
1703
1704                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "VCID:0x%X",
1705                                 ntohs(pstAddIndication->u16VCID));
1706                 uiSearchRuleIndex = SearchFreeSfid(Adapter);
1707                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "uiSearchRuleIndex:0x%X ",
1708                                 uiSearchRuleIndex);
1709                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Direction:0x%X ",
1710                                 pstAddIndication->u8Direction);
1711                 if ((uiSearchRuleIndex < NO_OF_QUEUES)) {
1712                         Adapter->PackInfo[uiSearchRuleIndex].ucDirection =
1713                                 pstAddIndication->u8Direction;
1714                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "bValid:0x%X ",
1715                                         pstAddIndication->sfActiveSet.bValid);
1716                         if (pstAddIndication->sfActiveSet.bValid == TRUE)
1717                                 Adapter->PackInfo[uiSearchRuleIndex].bActiveSet = TRUE;
1718
1719                         if (pstAddIndication->sfAuthorizedSet.bValid == TRUE)
1720                                 Adapter->PackInfo[uiSearchRuleIndex].bAuthorizedSet = TRUE;
1721
1722                         if (pstAddIndication->sfAdmittedSet.bValid == TRUE)
1723                                 Adapter->PackInfo[uiSearchRuleIndex].bAdmittedSet = TRUE;
1724
1725                         if (pstAddIndication->sfActiveSet.bValid == FALSE) {
1726                                 Adapter->PackInfo[uiSearchRuleIndex].bActive = FALSE;
1727                                 Adapter->PackInfo[uiSearchRuleIndex].bActivateRequestSent = FALSE;
1728                                 if (pstAddIndication->sfAdmittedSet.bValid)
1729                                         psfLocalSet = &pstAddIndication->sfAdmittedSet;
1730                                 else if (pstAddIndication->sfAuthorizedSet.bValid)
1731                                         psfLocalSet = &pstAddIndication->sfAuthorizedSet;
1732                         } else {
1733                                 psfLocalSet = &pstAddIndication->sfActiveSet;
1734                                 Adapter->PackInfo[uiSearchRuleIndex].bActive = TRUE;
1735                         }
1736
1737                         if (!psfLocalSet) {
1738                                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "No set is valid\n");
1739                                 Adapter->PackInfo[uiSearchRuleIndex].bActive = FALSE;
1740                                 Adapter->PackInfo[uiSearchRuleIndex].bValid = FALSE;
1741                                 Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value = 0;
1742                                 kfree(pstAddIndication);
1743                         } else if (psfLocalSet->bValid && (pstAddIndication->u8CC == 0)) {
1744                                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "DSA ACK");
1745                                 Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value = ntohs(pstAddIndication->u16VCID);
1746                                 Adapter->PackInfo[uiSearchRuleIndex].usCID = ntohs(pstAddIndication->u16CID);
1747
1748                                 if (UPLINK_DIR == pstAddIndication->u8Direction)
1749                                         atomic_set(&Adapter->PackInfo[uiSearchRuleIndex].uiPerSFTxResourceCount, DEFAULT_PERSFCOUNT);
1750
1751                                 CopyToAdapter(Adapter, psfLocalSet, uiSearchRuleIndex, DSA_ACK, pstAddIndication);
1752                                 /* don't free pstAddIndication */
1753
1754                                 /* Inside CopyToAdapter, Sorting of all the SFs take place.
1755                                  * Hence any access to the newly added SF through uiSearchRuleIndex is invalid.
1756                                  * SHOULD BE STRICTLY AVOIDED.
1757                                  */
1758                                 /* *(PULONG)(((PUCHAR)pvBuffer)+1)=psfLocalSet->u32SFID; */
1759                                 memcpy((((PUCHAR)pvBuffer)+1), &psfLocalSet->u32SFID, 4);
1760
1761                                 if (pstAddIndication->sfActiveSet.bValid == TRUE) {
1762                                         if (UPLINK_DIR == pstAddIndication->u8Direction) {
1763                                                 if (!Adapter->LinkUpStatus) {
1764                                                         netif_carrier_on(Adapter->dev);
1765                                                         netif_start_queue(Adapter->dev);
1766                                                         Adapter->LinkUpStatus = 1;
1767                                                         if (netif_msg_link(Adapter))
1768                                                                 pr_info(PFX "%s: link up\n", Adapter->dev->name);
1769                                                         atomic_set(&Adapter->TxPktAvail, 1);
1770                                                         wake_up(&Adapter->tx_packet_wait_queue);
1771                                                         Adapter->liTimeSinceLastNetEntry = get_seconds();
1772                                                 }
1773                                         }
1774                                 }
1775                         } else {
1776                                 Adapter->PackInfo[uiSearchRuleIndex].bActive = FALSE;
1777                                 Adapter->PackInfo[uiSearchRuleIndex].bValid = FALSE;
1778                                 Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value = 0;
1779                                 kfree(pstAddIndication);
1780                         }
1781                 } else {
1782                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "DSA ACK did not get valid SFID");
1783                         kfree(pstAddIndication);
1784                         return FALSE;
1785                 }
1786         }
1787         break;
1788         case DSC_REQ:
1789         {
1790                 pLeader->PLength = sizeof(stLocalSFChangeIndicationAlt);
1791                 pstChangeIndication = (stLocalSFChangeIndicationAlt *)pstAddIndication;
1792                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SENDING DSC RESPONSE TO MAC %d", pLeader->PLength);
1793
1794                 *((stLocalSFChangeIndicationAlt *)&(Adapter->caDsxReqResp[LEADER_SIZE])) = *pstChangeIndication;
1795                 ((stLocalSFChangeIndicationAlt *)&(Adapter->caDsxReqResp[LEADER_SIZE]))->u8Type = DSC_RSP;
1796
1797                 CopyBufferToControlPacket(Adapter, (PVOID)Adapter->caDsxReqResp);
1798                 kfree(pstAddIndication);
1799         }
1800         break;
1801         case DSC_RSP:
1802         {
1803                 pLeader->PLength = sizeof(stLocalSFChangeIndicationAlt);
1804                 pstChangeIndication = (stLocalSFChangeIndicationAlt *)pstAddIndication;
1805                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SENDING DSC ACK TO MAC %d", pLeader->PLength);
1806                 *((stLocalSFChangeIndicationAlt *)&(Adapter->caDsxReqResp[LEADER_SIZE])) = *pstChangeIndication;
1807                 ((stLocalSFChangeIndicationAlt *)&(Adapter->caDsxReqResp[LEADER_SIZE]))->u8Type = DSC_ACK;
1808         }
1809         case DSC_ACK:
1810         {
1811                 UINT uiSearchRuleIndex = 0;
1812
1813                 pstChangeIndication = (stLocalSFChangeIndicationAlt *)pstAddIndication;
1814                 uiSearchRuleIndex = SearchSfid(Adapter, ntohl(pstChangeIndication->sfActiveSet.u32SFID));
1815                 if (uiSearchRuleIndex > NO_OF_QUEUES-1)
1816                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "SF doesn't exist for which DSC_ACK is received");
1817
1818                 if ((uiSearchRuleIndex < NO_OF_QUEUES)) {
1819                         Adapter->PackInfo[uiSearchRuleIndex].ucDirection = pstChangeIndication->u8Direction;
1820                         if (pstChangeIndication->sfActiveSet.bValid == TRUE)
1821                                 Adapter->PackInfo[uiSearchRuleIndex].bActiveSet = TRUE;
1822
1823                         if (pstChangeIndication->sfAuthorizedSet.bValid == TRUE)
1824                                 Adapter->PackInfo[uiSearchRuleIndex].bAuthorizedSet = TRUE;
1825
1826                         if (pstChangeIndication->sfAdmittedSet.bValid == TRUE)
1827                                 Adapter->PackInfo[uiSearchRuleIndex].bAdmittedSet = TRUE;
1828
1829                         if (pstChangeIndication->sfActiveSet.bValid == FALSE) {
1830                                 Adapter->PackInfo[uiSearchRuleIndex].bActive = FALSE;
1831                                 Adapter->PackInfo[uiSearchRuleIndex].bActivateRequestSent = FALSE;
1832
1833                                 if (pstChangeIndication->sfAdmittedSet.bValid)
1834                                         psfLocalSet = &pstChangeIndication->sfAdmittedSet;
1835                                 else if (pstChangeIndication->sfAuthorizedSet.bValid)
1836                                         psfLocalSet = &pstChangeIndication->sfAuthorizedSet;
1837                         } else {
1838                                 psfLocalSet = &pstChangeIndication->sfActiveSet;
1839                                 Adapter->PackInfo[uiSearchRuleIndex].bActive = TRUE;
1840                         }
1841
1842                         if (!psfLocalSet) {
1843                                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "No set is valid\n");
1844                                 Adapter->PackInfo[uiSearchRuleIndex].bActive = FALSE;
1845                                 Adapter->PackInfo[uiSearchRuleIndex].bValid = FALSE;
1846                                 Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value = 0;
1847                                 kfree(pstAddIndication);
1848                         } else if (psfLocalSet->bValid && (pstChangeIndication->u8CC == 0)) {
1849                                 Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value = ntohs(pstChangeIndication->u16VCID);
1850                                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "CC field is %d bvalid = %d\n",
1851                                                 pstChangeIndication->u8CC, psfLocalSet->bValid);
1852                                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "VCID= %d\n", ntohs(pstChangeIndication->u16VCID));
1853                                 Adapter->PackInfo[uiSearchRuleIndex].usCID = ntohs(pstChangeIndication->u16CID);
1854                                 CopyToAdapter(Adapter, psfLocalSet, uiSearchRuleIndex, DSC_ACK, pstAddIndication);
1855
1856                                 *(PULONG)(((PUCHAR)pvBuffer)+1) = psfLocalSet->u32SFID;
1857                         } else if (pstChangeIndication->u8CC == 6) {
1858                                 deleteSFBySfid(Adapter, uiSearchRuleIndex);
1859                                 kfree(pstAddIndication);
1860                         }
1861                 } else {
1862                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "DSC ACK did not get valid SFID");
1863                         kfree(pstAddIndication);
1864                         return FALSE;
1865                 }
1866         }
1867         break;
1868         case DSD_REQ:
1869         {
1870                 UINT uiSearchRuleIndex;
1871                 ULONG ulSFID;
1872
1873                 pLeader->PLength = sizeof(stLocalSFDeleteIndication);
1874                 *((stLocalSFDeleteIndication *)&(Adapter->caDsxReqResp[LEADER_SIZE])) = *((stLocalSFDeleteIndication *)pstAddIndication);
1875
1876                 ulSFID = ntohl(((stLocalSFDeleteIndication *)pstAddIndication)->u32SFID);
1877                 uiSearchRuleIndex = SearchSfid(Adapter, ulSFID);
1878                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "DSD - Removing connection %x", uiSearchRuleIndex);
1879
1880                 if (uiSearchRuleIndex < NO_OF_QUEUES) {
1881                         /* Delete All Classifiers Associated with this SFID */
1882                         deleteSFBySfid(Adapter, uiSearchRuleIndex);
1883                         Adapter->u32TotalDSD++;
1884                 }
1885
1886                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SENDING DSD RESPONSE TO MAC");
1887                 ((stLocalSFDeleteIndication *)&(Adapter->caDsxReqResp[LEADER_SIZE]))->u8Type = DSD_RSP;
1888                 CopyBufferToControlPacket(Adapter, (PVOID)Adapter->caDsxReqResp);
1889         }
1890         case DSD_RSP:
1891         {
1892                 /* Do nothing as SF has already got Deleted */
1893         }
1894         break;
1895         case DSD_ACK:
1896                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "DSD ACK Rcd, let App handle it\n");
1897                 break;
1898         default:
1899                 kfree(pstAddIndication);
1900                 return FALSE;
1901         }
1902         return TRUE;
1903 }
1904
1905 int get_dsx_sf_data_to_application(struct bcm_mini_adapter *Adapter, UINT uiSFId, void __user *user_buffer)
1906 {
1907         int status = 0;
1908         struct bcm_packet_info *psSfInfo = NULL;
1909
1910         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "status =%d", status);
1911         status = SearchSfid(Adapter, uiSFId);
1912         if (status >= NO_OF_QUEUES) {
1913                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SFID %d not present in queue !!!", uiSFId);
1914                 return -EINVAL;
1915         }
1916         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "status =%d", status);
1917         psSfInfo = &Adapter->PackInfo[status];
1918         if (psSfInfo->pstSFIndication && copy_to_user(user_buffer,
1919                                                         psSfInfo->pstSFIndication, sizeof(stLocalSFAddIndicationAlt))) {
1920                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "copy to user failed SFID %d, present in queue !!!", uiSFId);
1921                 status = -EFAULT;
1922                 return status;
1923         }
1924         return STATUS_SUCCESS;
1925 }
1926
1927 VOID OverrideServiceFlowParams(struct bcm_mini_adapter *Adapter, PUINT puiBuffer)
1928 {
1929         B_UINT32 u32NumofSFsinMsg = ntohl(*(puiBuffer + 1));
1930         stIM_SFHostNotify *pHostInfo = NULL;
1931         UINT uiSearchRuleIndex = 0;
1932         ULONG ulSFID = 0;
1933
1934         puiBuffer += 2;
1935         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "u32NumofSFsinMsg: 0x%x\n", u32NumofSFsinMsg);
1936
1937         while (u32NumofSFsinMsg != 0 && u32NumofSFsinMsg < NO_OF_QUEUES) {
1938                 u32NumofSFsinMsg--;
1939                 pHostInfo = (stIM_SFHostNotify *)puiBuffer;
1940                 puiBuffer = (PUINT)(pHostInfo + 1);
1941
1942                 ulSFID = ntohl(pHostInfo->SFID);
1943                 uiSearchRuleIndex = SearchSfid(Adapter, ulSFID);
1944                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SFID: 0x%lx\n", ulSFID);
1945
1946                 if (uiSearchRuleIndex >= NO_OF_QUEUES || uiSearchRuleIndex == HiPriority) {
1947                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "The SFID <%lx> doesn't exist in host entry or is Invalid\n", ulSFID);
1948                         continue;
1949                 }
1950
1951                 if (pHostInfo->RetainSF == FALSE) {
1952                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Going to Delete SF");
1953                         deleteSFBySfid(Adapter, uiSearchRuleIndex);
1954                 } else {
1955                         Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value = ntohs(pHostInfo->VCID);
1956                         Adapter->PackInfo[uiSearchRuleIndex].usCID = ntohs(pHostInfo->newCID);
1957                         Adapter->PackInfo[uiSearchRuleIndex].bActive = FALSE;
1958
1959                         BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "pHostInfo->QoSParamSet: 0x%x\n", pHostInfo->QoSParamSet);
1960
1961                         if (pHostInfo->QoSParamSet & 0x1)
1962                                 Adapter->PackInfo[uiSearchRuleIndex].bAuthorizedSet = TRUE;
1963                         if (pHostInfo->QoSParamSet & 0x2)
1964                                 Adapter->PackInfo[uiSearchRuleIndex].bAdmittedSet = TRUE;
1965                         if (pHostInfo->QoSParamSet & 0x4) {
1966                                 Adapter->PackInfo[uiSearchRuleIndex].bActiveSet = TRUE;
1967                                 Adapter->PackInfo[uiSearchRuleIndex].bActive = TRUE;
1968                         }
1969                 }
1970         }
1971 }