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