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