Merge branch 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[pandora-kernel.git] / drivers / staging / bcm / CmHost.c
1 /************************************************************
2 *                       CMHOST.C
3 *       This file contains the routines for handling Connnection
4 *       Management.
5 ************************************************************/
6
7 //#define CONN_MSG
8 #include "headers.h"
9
10 typedef enum _E_CLASSIFIER_ACTION
11 {
12         eInvalidClassifierAction,
13         eAddClassifier,
14         eReplaceClassifier,
15         eDeleteClassifier
16 }E_CLASSIFIER_ACTION;
17
18 static ULONG GetNextTargetBufferLocation(PMINI_ADAPTER Adapter,B_UINT16 tid);
19
20 /************************************************************
21 * Function        -     SearchSfid
22 *
23 * Description - This routinue would search QOS queues having
24 *                               specified SFID as input parameter.
25 *
26 * Parameters  - Adapter: Pointer to the Adapter structure
27 *                               uiSfid : Given SFID for matching
28 *
29 * Returns         - Queue index for this SFID(If matched)
30                                 Else Invalid Queue Index(If Not matched)
31 ************************************************************/
32 INT SearchSfid(PMINI_ADAPTER Adapter,UINT uiSfid)
33 {
34         INT     iIndex=0;
35         for(iIndex=(NO_OF_QUEUES-1); iIndex>=0; iIndex--)
36                 if(Adapter->PackInfo[iIndex].ulSFID==uiSfid)
37                         return iIndex;
38         return NO_OF_QUEUES+1;
39 }
40
41 /***************************************************************
42 * Function        -     SearchFreeSfid
43 *
44 * Description - This routinue would search Free available SFID.
45 *
46 * Parameter   - Adapter: Pointer to the Adapter structure
47 *
48 * Returns         - Queue index for the free SFID
49 *                               Else returns Invalid Index.
50 ****************************************************************/
51 static INT SearchFreeSfid(PMINI_ADAPTER Adapter)
52 {
53         UINT    uiIndex=0;
54
55         for(uiIndex=0; uiIndex < (NO_OF_QUEUES-1); uiIndex++)
56                 if(Adapter->PackInfo[uiIndex].ulSFID==0)
57                         return uiIndex;
58         return NO_OF_QUEUES+1;
59 }
60
61 /*
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         if(Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication)
978         {
979                 kfree(Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication);
980                 Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication = NULL;
981         }
982         Adapter->PackInfo[uiSearchRuleIndex].pstSFIndication = pstAddIndication;
983
984         //Re Sort the SF list in PackInfo according to Traffic Priority
985         SortPackInfo(Adapter);
986
987         /* Re Sort the Classifier Rules table and re - arrange
988                 according to Classifier Rule Priority */
989         SortClassifiers(Adapter);
990
991         DumpPhsRules(&Adapter->stBCMPhsContext);
992
993         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"%s <=====", __FUNCTION__);
994 }
995
996
997 /***********************************************************************
998 * Function        -     DumpCmControlPacket
999 *
1000 * Description - This routinue Dumps the Contents of the AddIndication
1001 *                               Structure in the Connection Management Control Packet
1002 *
1003 * Parameter   - pvBuffer: Pointer to the buffer containing the
1004 *                               AddIndication data.
1005 *
1006 * Returns         - None
1007 *************************************************************************/
1008 static VOID DumpCmControlPacket(PVOID pvBuffer)
1009 {
1010         UINT                                    uiLoopIndex;
1011         UINT                    nIndex;
1012         stLocalSFAddIndicationAlt  *pstAddIndication;
1013         UINT                    nCurClassifierCnt;
1014     PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev);
1015
1016         pstAddIndication = (stLocalSFAddIndicationAlt *)pvBuffer;
1017         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "======>");
1018
1019         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8Type           : 0x%X",pstAddIndication->u8Type);
1020         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8Direction      : 0x%X",pstAddIndication->u8Direction);
1021         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16TID: 0x%X", ntohs(pstAddIndication->u16TID));
1022         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16CID            : 0x%X",ntohs(pstAddIndication->u16CID));
1023         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16VCID           : 0x%X",ntohs(pstAddIndication->u16VCID));
1024
1025         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " AuthorizedSet--->");
1026
1027         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32SFID          : 0x%X",htonl(pstAddIndication->sfAuthorizedSet.u32SFID));
1028         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16CID           : 0x%X",htons(pstAddIndication->sfAuthorizedSet.u16CID));
1029         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ServiceClassNameLength : 0x%X",
1030                 pstAddIndication->sfAuthorizedSet.u8ServiceClassNameLength);
1031
1032         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",
1033                         pstAddIndication->sfAuthorizedSet.u8ServiceClassName[0],
1034                         pstAddIndication->sfAuthorizedSet.u8ServiceClassName[1],
1035                         pstAddIndication->sfAuthorizedSet.u8ServiceClassName[2],
1036                         pstAddIndication->sfAuthorizedSet.u8ServiceClassName[3],
1037                         pstAddIndication->sfAuthorizedSet.u8ServiceClassName[4],
1038                         pstAddIndication->sfAuthorizedSet.u8ServiceClassName[5]);
1039
1040         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8MBSService             : 0x%X",
1041                 pstAddIndication->sfAuthorizedSet.u8MBSService);
1042         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8QosParamSet            : 0x%X",
1043                 pstAddIndication->sfAuthorizedSet.u8QosParamSet);
1044         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8TrafficPriority : 0x%X, %p",
1045                 pstAddIndication->sfAuthorizedSet.u8TrafficPriority, &pstAddIndication->sfAuthorizedSet.u8TrafficPriority);
1046
1047         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32MaxSustainedTrafficRate       : 0x%X 0x%p",
1048                 pstAddIndication->sfAuthorizedSet.u32MaxSustainedTrafficRate,
1049                         &pstAddIndication->sfAuthorizedSet.u32MaxSustainedTrafficRate);
1050
1051         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32MaxTrafficBurst                        : 0x%X",
1052                 pstAddIndication->sfAuthorizedSet.u32MaxTrafficBurst);
1053         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32MinReservedTrafficRate : 0x%X",
1054                 pstAddIndication->sfAuthorizedSet.u32MinReservedTrafficRate);
1055         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8VendorSpecificQoSParamLength    : 0x%X",
1056                 pstAddIndication->sfAuthorizedSet.u8VendorSpecificQoSParamLength);
1057         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8VendorSpecificQoSParam          : 0x%X",
1058                 pstAddIndication->sfAuthorizedSet.u8VendorSpecificQoSParam[0]);
1059         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8ServiceFlowSchedulingType               : 0x%X",
1060                 pstAddIndication->sfAuthorizedSet.u8ServiceFlowSchedulingType);
1061         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u32ToleratedJitter                                : 0x%X",
1062                 pstAddIndication->sfAuthorizedSet.u32ToleratedJitter);
1063     BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32MaximumLatency                            : 0x%X",
1064                 pstAddIndication->sfAuthorizedSet.u32MaximumLatency);
1065         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8FixedLengthVSVariableLengthSDUIndicator: 0x%X",
1066                 pstAddIndication->sfAuthorizedSet.u8FixedLengthVSVariableLengthSDUIndicator);
1067
1068         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8SDUSize                         : 0x%X",
1069                 pstAddIndication->sfAuthorizedSet.u8SDUSize);
1070         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16TargetSAID                    : 0x%X",
1071                 pstAddIndication->sfAuthorizedSet.u16TargetSAID);
1072         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ARQEnable                              : 0x%X",
1073                 pstAddIndication->sfAuthorizedSet.u8ARQEnable);
1074         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16ARQWindowSize          : 0x%X",
1075                 pstAddIndication->sfAuthorizedSet.u16ARQWindowSize);
1076         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16ARQRetryTxTimeOut      : 0x%X",
1077                 pstAddIndication->sfAuthorizedSet.u16ARQRetryTxTimeOut);
1078         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQRetryRxTimeOut     : 0x%X",
1079                 pstAddIndication->sfAuthorizedSet.u16ARQRetryRxTimeOut);
1080         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u16ARQBlockLifeTime               : 0x%X",
1081                 pstAddIndication->sfAuthorizedSet.u16ARQBlockLifeTime);
1082         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQSyncLossTimeOut    : 0x%X",
1083                 pstAddIndication->sfAuthorizedSet.u16ARQSyncLossTimeOut);
1084         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ARQDeliverInOrder              : 0x%X",
1085                 pstAddIndication->sfAuthorizedSet.u8ARQDeliverInOrder);
1086         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQRxPurgeTimeOut     : 0x%X",
1087                 pstAddIndication->sfAuthorizedSet.u16ARQRxPurgeTimeOut);
1088         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQBlockSize                  : 0x%X",
1089                 pstAddIndication->sfAuthorizedSet.u16ARQBlockSize);
1090         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8CSSpecification                : 0x%X",
1091                 pstAddIndication->sfAuthorizedSet.u8CSSpecification);
1092         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8TypeOfDataDeliveryService      : 0x%X",
1093                 pstAddIndication->sfAuthorizedSet.u8TypeOfDataDeliveryService);
1094         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16SDUInterArrivalTime   : 0x%X",
1095                 pstAddIndication->sfAuthorizedSet.u16SDUInterArrivalTime);
1096         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16TimeBase                              : 0x%X",
1097                 pstAddIndication->sfAuthorizedSet.u16TimeBase);
1098         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8PagingPreference               : 0x%X",
1099                 pstAddIndication->sfAuthorizedSet.u8PagingPreference);
1100         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16UnsolicitedPollingInterval            : 0x%X",
1101                 pstAddIndication->sfAuthorizedSet.u16UnsolicitedPollingInterval);
1102
1103         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "sfAuthorizedSet.u8HARQChannelMapping %x  %x %x ",
1104                                 *(unsigned int*)pstAddIndication->sfAuthorizedSet.u8HARQChannelMapping,
1105                                 *(unsigned int*)&pstAddIndication->sfAuthorizedSet.u8HARQChannelMapping[4],
1106                         *(USHORT*) &pstAddIndication->sfAuthorizedSet.u8HARQChannelMapping[8]);
1107         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8TrafficIndicationPreference    : 0x%X",
1108                 pstAddIndication->sfAuthorizedSet.u8TrafficIndicationPreference);
1109
1110         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " Total Classifiers Recieved              : 0x%X",pstAddIndication->sfAuthorizedSet.u8TotalClassifiers);
1111
1112         nCurClassifierCnt = pstAddIndication->sfAuthorizedSet.u8TotalClassifiers;
1113
1114         if(nCurClassifierCnt > MAX_CLASSIFIERS_IN_SF)
1115         {
1116                 nCurClassifierCnt = MAX_CLASSIFIERS_IN_SF;
1117         }
1118         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "pstAddIndication->sfAuthorizedSet.bValid %d", pstAddIndication->sfAuthorizedSet.bValid);
1119         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "pstAddIndication->sfAuthorizedSet.u16MacOverhead %x", pstAddIndication->sfAuthorizedSet.u16MacOverhead);
1120         if(!pstAddIndication->sfAuthorizedSet.bValid)
1121                 pstAddIndication->sfAuthorizedSet.bValid=1;
1122         for(nIndex = 0 ; nIndex < nCurClassifierCnt ; nIndex++)
1123         {
1124                 stConvergenceSLTypes *psfCSType = NULL;
1125                 psfCSType =  &pstAddIndication->sfAuthorizedSet.cConvergenceSLTypes[nIndex];
1126
1127                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "psfCSType = %p", psfCSType);
1128                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "CCPacketClassificationRuleSI====>");
1129
1130                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ClassifierRulePriority         :0x%X ",
1131                         psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority);
1132                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPTypeOfServiceLength                  :0x%X ",
1133                         psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength);
1134
1135                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPTypeOfService[3]                     :0x%X ,0x%X ,0x%X ",
1136                         psfCSType->cCPacketClassificationRule.u8IPTypeOfService[0],
1137                         psfCSType->cCPacketClassificationRule.u8IPTypeOfService[1],
1138                         psfCSType->cCPacketClassificationRule.u8IPTypeOfService[2]);
1139
1140                 for(uiLoopIndex=0; uiLoopIndex < 1; uiLoopIndex++)
1141                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8Protocol : 0x%02X ",
1142                         psfCSType->cCPacketClassificationRule.u8Protocol);
1143
1144                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPMaskedSourceAddressLength    :0x%X ",
1145                         psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddressLength);
1146
1147                 for(uiLoopIndex=0; uiLoopIndex < 32; uiLoopIndex++)
1148                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPMaskedSourceAddress[32]      : 0x%02X ",
1149                         psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddress[uiLoopIndex]);
1150
1151                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPDestinationAddressLength : 0x%X ",
1152                         psfCSType->cCPacketClassificationRule.u8IPDestinationAddressLength);
1153
1154                 for(uiLoopIndex=0; uiLoopIndex < 32; uiLoopIndex++)
1155                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPDestinationAddress[32] : 0x%02X ",
1156                         psfCSType->cCPacketClassificationRule.u8IPDestinationAddress[uiLoopIndex]);
1157
1158                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ProtocolSourcePortRangeLength:0x%X ",
1159                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength);
1160                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ProtocolSourcePortRange[4]: 0x%02X ,0x%02X ,0x%02X ,0x%02X ",
1161                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[0],
1162                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[1],
1163                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[2],
1164                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[3]);
1165
1166                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ProtocolDestPortRangeLength : 0x%02X ",
1167                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength);
1168                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ProtocolDestPortRange[4]: 0x%02X ,0x%02X ,0x%02X ,0x%02X ",
1169                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[0],
1170                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[1],
1171                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[2],
1172                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[3]);
1173
1174                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8EthernetDestMacAddressLength : 0x%02X ",
1175                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
1176
1177                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8EthernetDestMacAddress[6] : 0x %02X %02X %02X %02X %02X %02X",
1178                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[0],
1179                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[1],
1180                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[2],
1181                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[3],
1182                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[4],
1183                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[5]);
1184
1185                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8EthernetSourceMACAddressLength : 0x%02X ",
1186                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
1187
1188                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8EthernetSourceMACAddress[6] : 0x %02X %02X %02X %02X %02X %02X",
1189                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[0],
1190                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[1],
1191                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[2],
1192                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[3],
1193                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[4],
1194                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[5]);
1195
1196                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8EthertypeLength        : 0x%02X ",
1197                         psfCSType->cCPacketClassificationRule.u8EthertypeLength);
1198                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8Ethertype[3] : 0x%02X ,0x%02X ,0x%02X ",
1199                         psfCSType->cCPacketClassificationRule.u8Ethertype[0],
1200                         psfCSType->cCPacketClassificationRule.u8Ethertype[1],
1201                         psfCSType->cCPacketClassificationRule.u8Ethertype[2]);
1202
1203                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16UserPriority          : 0x%X ",
1204                         psfCSType->cCPacketClassificationRule.u16UserPriority);
1205
1206                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16VLANID                        : 0x%X ",
1207                         psfCSType->cCPacketClassificationRule.u16VLANID);
1208
1209                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8AssociatedPHSI : 0x%02X ",
1210                         psfCSType->cCPacketClassificationRule.u8AssociatedPHSI);
1211
1212                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16PacketClassificationRuleIndex : 0x%X ",
1213                         psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex);
1214
1215                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8VendorSpecificClassifierParamLength    : 0x%X ",
1216                         psfCSType->cCPacketClassificationRule.u8VendorSpecificClassifierParamLength);
1217
1218                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8VendorSpecificClassifierParam[1]               : 0x%X ",
1219                         psfCSType->cCPacketClassificationRule.u8VendorSpecificClassifierParam[0]);
1220 #ifdef VERSION_D5
1221                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPv6FlowLableLength                            :0x%X ",
1222                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLableLength);
1223                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPv6FlowLable[6] : 0x %02X %02X %02X %02X %02X %02X ",
1224                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[0],
1225                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[1],
1226                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[2],
1227                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[3],
1228                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[4],
1229                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[5]);
1230 #endif
1231         }
1232
1233         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "bValid           : 0x%02X",pstAddIndication->sfAuthorizedSet.bValid);
1234
1235         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "AdmittedSet--->");
1236         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32SFID          : 0x%X",pstAddIndication->sfAdmittedSet.u32SFID);
1237         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16CID           : 0x%X",pstAddIndication->sfAdmittedSet.u16CID);
1238         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ServiceClassNameLength : 0x%X",
1239                 pstAddIndication->sfAdmittedSet.u8ServiceClassNameLength);
1240         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ServiceClassName                       : 0x %02X %02X %02X %02X %02X %02X",
1241                         pstAddIndication->sfAdmittedSet.u8ServiceClassName[0],
1242                         pstAddIndication->sfAdmittedSet.u8ServiceClassName[1],
1243                         pstAddIndication->sfAdmittedSet.u8ServiceClassName[2],
1244                         pstAddIndication->sfAdmittedSet.u8ServiceClassName[3],
1245                         pstAddIndication->sfAdmittedSet.u8ServiceClassName[4],
1246                         pstAddIndication->sfAdmittedSet.u8ServiceClassName[5]);
1247
1248         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8MBSService                             : 0x%02X",
1249                         pstAddIndication->sfAdmittedSet.u8MBSService);
1250         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8QosParamSet                            : 0x%02X",
1251                         pstAddIndication->sfAdmittedSet.u8QosParamSet);
1252         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8TrafficPriority                        : 0x%02X",
1253                         pstAddIndication->sfAdmittedSet.u8TrafficPriority);
1254         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32MaxTrafficBurst                       : 0x%X",
1255                         pstAddIndication->sfAdmittedSet.u32MaxTrafficBurst);
1256         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32MinReservedTrafficRate        : 0x%X",
1257                 pstAddIndication->sfAdmittedSet.u32MinReservedTrafficRate);
1258
1259         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8VendorSpecificQoSParamLength   : 0x%02X",
1260                 pstAddIndication->sfAdmittedSet.u8VendorSpecificQoSParamLength);
1261         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8VendorSpecificQoSParam         : 0x%02X",
1262                 pstAddIndication->sfAdmittedSet.u8VendorSpecificQoSParam[0]);
1263         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ServiceFlowSchedulingType              : 0x%02X",
1264                 pstAddIndication->sfAdmittedSet.u8ServiceFlowSchedulingType);
1265
1266         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32ToleratedJitter                               : 0x%X",
1267                 pstAddIndication->sfAdmittedSet.u32ToleratedJitter);
1268     BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32MaximumLatency                            : 0x%X",
1269                 pstAddIndication->sfAdmittedSet.u32MaximumLatency);
1270
1271         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8FixedLengthVSVariableLengthSDUIndicator: 0x%02X",
1272                 pstAddIndication->sfAdmittedSet.u8FixedLengthVSVariableLengthSDUIndicator);
1273         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8SDUSize                        : 0x%02X",
1274                 pstAddIndication->sfAdmittedSet.u8SDUSize);
1275         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16TargetSAID            : 0x%02X",
1276                 pstAddIndication->sfAdmittedSet.u16TargetSAID);
1277         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ARQEnable                      : 0x%02X",
1278                 pstAddIndication->sfAdmittedSet.u8ARQEnable);
1279
1280         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQWindowSize         : 0x%X",
1281                 pstAddIndication->sfAdmittedSet.u16ARQWindowSize);
1282         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQRetryTxTimeOut     : 0x%X",
1283                 pstAddIndication->sfAdmittedSet.u16ARQRetryTxTimeOut);
1284         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQRetryRxTimeOut     : 0x%X",
1285                 pstAddIndication->sfAdmittedSet.u16ARQRetryRxTimeOut);
1286         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQBlockLifeTime              : 0x%X",
1287                 pstAddIndication->sfAdmittedSet.u16ARQBlockLifeTime);
1288         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQSyncLossTimeOut    : 0x%X",
1289                 pstAddIndication->sfAdmittedSet.u16ARQSyncLossTimeOut);
1290
1291         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ARQDeliverInOrder              : 0x%02X",
1292                 pstAddIndication->sfAdmittedSet.u8ARQDeliverInOrder);
1293         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQRxPurgeTimeOut     : 0x%X",
1294                 pstAddIndication->sfAdmittedSet.u16ARQRxPurgeTimeOut);
1295         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16ARQBlockSize                  : 0x%X",
1296                 pstAddIndication->sfAdmittedSet.u16ARQBlockSize);
1297         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8CSSpecification                : 0x%02X",
1298                 pstAddIndication->sfAdmittedSet.u8CSSpecification);
1299         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8TypeOfDataDeliveryService      : 0x%02X",
1300                 pstAddIndication->sfAdmittedSet.u8TypeOfDataDeliveryService);
1301         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16SDUInterArrivalTime   : 0x%X",
1302                 pstAddIndication->sfAdmittedSet.u16SDUInterArrivalTime);
1303         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16TimeBase                              : 0x%X",
1304                 pstAddIndication->sfAdmittedSet.u16TimeBase);
1305         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8PagingPreference               : 0x%X",
1306                 pstAddIndication->sfAdmittedSet.u8PagingPreference);
1307
1308
1309         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8TrafficIndicationPreference    : 0x%02X",
1310                 pstAddIndication->sfAdmittedSet.u8TrafficIndicationPreference);
1311
1312         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " Total Classifiers Recieved              : 0x%X",pstAddIndication->sfAdmittedSet.u8TotalClassifiers);
1313
1314         nCurClassifierCnt = pstAddIndication->sfAdmittedSet.u8TotalClassifiers;
1315
1316         if(nCurClassifierCnt > MAX_CLASSIFIERS_IN_SF)
1317         {
1318                 nCurClassifierCnt = MAX_CLASSIFIERS_IN_SF;
1319         }
1320
1321
1322         for(nIndex = 0 ; nIndex < nCurClassifierCnt ; nIndex++)
1323         {
1324
1325                 stConvergenceSLTypes *psfCSType = NULL;
1326                 psfCSType =  &pstAddIndication->sfAdmittedSet.cConvergenceSLTypes[nIndex];
1327
1328                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " CCPacketClassificationRuleSI====>");
1329
1330                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ClassifierRulePriority :0x%02X ",
1331                         psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority);
1332                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPTypeOfServiceLength          :0x%02X",
1333                         psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength);
1334
1335                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPTypeOfService[3]             :0x%02X %02X %02X",
1336                         psfCSType->cCPacketClassificationRule.u8IPTypeOfService[0],
1337                         psfCSType->cCPacketClassificationRule.u8IPTypeOfService[1],
1338                         psfCSType->cCPacketClassificationRule.u8IPTypeOfService[2]);
1339                 for(uiLoopIndex=0; uiLoopIndex < 1; uiLoopIndex++)
1340                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8Protocol: 0x%02X ",
1341                         psfCSType->cCPacketClassificationRule.u8Protocol);
1342
1343                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPMaskedSourceAddressLength    :0x%02X ",
1344                         psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddressLength);
1345
1346                 for(uiLoopIndex=0; uiLoopIndex < 32; uiLoopIndex++)
1347                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPMaskedSourceAddress[32] : 0x%02X ",
1348                         psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddress[uiLoopIndex]);
1349
1350                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPDestinationAddressLength     : 0x%02X ",
1351                         psfCSType->cCPacketClassificationRule.u8IPDestinationAddressLength);
1352
1353                 for(uiLoopIndex=0; uiLoopIndex < 32; uiLoopIndex++)
1354                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPDestinationAddress[32] : 0x%02X ",
1355                         psfCSType->cCPacketClassificationRule.u8IPDestinationAddress[uiLoopIndex]);
1356
1357                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ProtocolSourcePortRangeLength  : 0x%02X ",
1358                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength);
1359
1360                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ProtocolSourcePortRange[4] : 0x %02X %02X %02X %02X ",
1361                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[0],
1362                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[1],
1363                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[2],
1364                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[3]);
1365
1366                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ProtocolDestPortRangeLength : 0x%02X ",
1367                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength);
1368
1369                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ProtocolDestPortRange[4] : 0x %02X %02X %02X %02X ",
1370                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[0],
1371                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[1],
1372                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[2],
1373                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[3]);
1374
1375                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8EthernetDestMacAddressLength : 0x%02X ",
1376                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
1377
1378                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8EthernetDestMacAddress[6] : 0x %02X %02X %02X %02X %02X %02X",
1379                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[0],
1380                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[1],
1381                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[2],
1382                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[3],
1383                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[4],
1384                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[5]);
1385
1386                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8EthernetSourceMACAddressLength : 0x%02X ",
1387                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
1388
1389                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8EthernetSourceMACAddress[6] : 0x %02X %02X %02X %02X %02X %02X",
1390                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[0],
1391                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[1],
1392                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[2],
1393                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[3],
1394                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[4],
1395                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[5]);
1396
1397                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8EthertypeLength        : 0x%02X ",
1398                         psfCSType->cCPacketClassificationRule.u8EthertypeLength);
1399                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8Ethertype[3]           : 0x%02X %02X %02X",
1400                         psfCSType->cCPacketClassificationRule.u8Ethertype[0],
1401                         psfCSType->cCPacketClassificationRule.u8Ethertype[1],
1402                         psfCSType->cCPacketClassificationRule.u8Ethertype[2]);
1403
1404                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16UserPriority  : 0x%X ",
1405                         psfCSType->cCPacketClassificationRule.u16UserPriority);
1406                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16VLANID                        : 0x%X ",
1407                         psfCSType->cCPacketClassificationRule.u16VLANID);
1408                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8AssociatedPHSI : 0x%02X ",
1409                         psfCSType->cCPacketClassificationRule.u8AssociatedPHSI);
1410                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16PacketClassificationRuleIndex : 0x%X ",
1411                         psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex);
1412
1413                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8VendorSpecificClassifierParamLength    : 0x%02X",
1414                         psfCSType->cCPacketClassificationRule.u8VendorSpecificClassifierParamLength);
1415                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8VendorSpecificClassifierParam[1]       : 0x%02X ",
1416                         psfCSType->cCPacketClassificationRule.u8VendorSpecificClassifierParam[0]);
1417 #ifdef VERSION_D5
1418                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPv6FlowLableLength                            : 0x%X ",
1419                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLableLength);
1420                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPv6FlowLable[6]       : 0x %02X %02X %02X %02X %02X %02X ",
1421                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[0],
1422                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[1],
1423                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[2],
1424                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[3],
1425                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[4],
1426                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[5]);
1427 #endif
1428         }
1429
1430         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "bValid           : 0x%X",pstAddIndication->sfAdmittedSet.bValid);
1431
1432         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " ActiveSet--->");
1433         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32SFID          : 0x%X",pstAddIndication->sfActiveSet.u32SFID);
1434         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u16CID           : 0x%X",pstAddIndication->sfActiveSet.u16CID);
1435
1436         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ServiceClassNameLength : 0x%X",
1437                 pstAddIndication->sfActiveSet.u8ServiceClassNameLength);
1438
1439         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ServiceClassName               : 0x %02X %02X %02X %02X %02X %02X",
1440                 pstAddIndication->sfActiveSet.u8ServiceClassName[0],
1441                 pstAddIndication->sfActiveSet.u8ServiceClassName[1],
1442                 pstAddIndication->sfActiveSet.u8ServiceClassName[2],
1443                 pstAddIndication->sfActiveSet.u8ServiceClassName[3],
1444                 pstAddIndication->sfActiveSet.u8ServiceClassName[4],
1445                 pstAddIndication->sfActiveSet.u8ServiceClassName[5]);
1446
1447         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8MBSService                             : 0x%02X",
1448                 pstAddIndication->sfActiveSet.u8MBSService);
1449         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8QosParamSet                            : 0x%02X",
1450                 pstAddIndication->sfActiveSet.u8QosParamSet);
1451         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8TrafficPriority                        : 0x%02X",
1452                 pstAddIndication->sfActiveSet.u8TrafficPriority);
1453         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32MaxTrafficBurst                       : 0x%X",
1454                 pstAddIndication->sfActiveSet.u32MaxTrafficBurst);
1455         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32MinReservedTrafficRate        : 0x%X",
1456                 pstAddIndication->sfActiveSet.u32MinReservedTrafficRate);
1457         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8VendorSpecificQoSParamLength   : 0x%02X",
1458                 pstAddIndication->sfActiveSet.u8VendorSpecificQoSParamLength);
1459         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8VendorSpecificQoSParam         : 0x%02X",
1460                 pstAddIndication->sfActiveSet.u8VendorSpecificQoSParam[0]);
1461         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8ServiceFlowSchedulingType              : 0x%02X",
1462                 pstAddIndication->sfActiveSet.u8ServiceFlowSchedulingType);
1463
1464         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32ToleratedJitter                               : 0x%X",
1465                 pstAddIndication->sfActiveSet.u32ToleratedJitter);
1466     BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u32MaximumLatency                            : 0x%X",
1467                 pstAddIndication->sfActiveSet.u32MaximumLatency);
1468
1469         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8FixedLengthVSVariableLengthSDUIndicator: 0x%02X",
1470            pstAddIndication->sfActiveSet.u8FixedLengthVSVariableLengthSDUIndicator);
1471
1472         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8SDUSize                                : 0x%X",
1473                 pstAddIndication->sfActiveSet.u8SDUSize);
1474         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16TargetSAID                   : 0x%X",
1475                 pstAddIndication->sfActiveSet.u16TargetSAID);
1476         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8ARQEnable                     : 0x%X",
1477                 pstAddIndication->sfActiveSet.u8ARQEnable);
1478         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16ARQWindowSize                : 0x%X",
1479                 pstAddIndication->sfActiveSet.u16ARQWindowSize);
1480         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16ARQRetryTxTimeOut    : 0x%X",
1481                 pstAddIndication->sfActiveSet.u16ARQRetryTxTimeOut);
1482         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16ARQRetryRxTimeOut    : 0x%X",
1483                 pstAddIndication->sfActiveSet.u16ARQRetryRxTimeOut);
1484         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16ARQBlockLifeTime     : 0x%X",
1485                 pstAddIndication->sfActiveSet.u16ARQBlockLifeTime);
1486         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16ARQSyncLossTimeOut   : 0x%X",
1487                 pstAddIndication->sfActiveSet.u16ARQSyncLossTimeOut);
1488         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8ARQDeliverInOrder     : 0x%X",
1489                 pstAddIndication->sfActiveSet.u8ARQDeliverInOrder);
1490         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16ARQRxPurgeTimeOut    : 0x%X",
1491                 pstAddIndication->sfActiveSet.u16ARQRxPurgeTimeOut);
1492         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16ARQBlockSize         : 0x%X",
1493                 pstAddIndication->sfActiveSet.u16ARQBlockSize);
1494         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8CSSpecification               : 0x%X",
1495                 pstAddIndication->sfActiveSet.u8CSSpecification);
1496         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8TypeOfDataDeliveryService     : 0x%X",
1497                 pstAddIndication->sfActiveSet.u8TypeOfDataDeliveryService);
1498         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16SDUInterArrivalTime  : 0x%X",
1499                 pstAddIndication->sfActiveSet.u16SDUInterArrivalTime);
1500         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16TimeBase                     : 0x%X",
1501                 pstAddIndication->sfActiveSet.u16TimeBase);
1502         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8PagingPreference              : 0x%X",
1503                 pstAddIndication->sfActiveSet.u8PagingPreference);
1504
1505
1506         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8TrafficIndicationPreference   : 0x%X",
1507                 pstAddIndication->sfActiveSet.u8TrafficIndicationPreference);
1508
1509         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " Total Classifiers Recieved              : 0x%X",pstAddIndication->sfActiveSet.u8TotalClassifiers);
1510
1511         nCurClassifierCnt = pstAddIndication->sfActiveSet.u8TotalClassifiers;
1512
1513         if(nCurClassifierCnt > MAX_CLASSIFIERS_IN_SF)
1514         {
1515                 nCurClassifierCnt = MAX_CLASSIFIERS_IN_SF;
1516         }
1517
1518         for(nIndex = 0 ; nIndex < nCurClassifierCnt ; nIndex++)
1519         {
1520
1521                 stConvergenceSLTypes *psfCSType = NULL;
1522                 psfCSType =  &pstAddIndication->sfActiveSet.cConvergenceSLTypes[nIndex];
1523
1524
1525                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " CCPacketClassificationRuleSI====>");
1526
1527                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8ClassifierRulePriority                :0x%X ",
1528                         psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority);
1529                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8IPTypeOfServiceLength         :0x%X ",
1530                         psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength);
1531
1532                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8IPTypeOfService[3]                    :0x%X ,0x%X ,0x%X ",
1533                         psfCSType->cCPacketClassificationRule.u8IPTypeOfService[0],
1534                         psfCSType->cCPacketClassificationRule.u8IPTypeOfService[1],
1535                         psfCSType->cCPacketClassificationRule.u8IPTypeOfService[2]);
1536                 for(uiLoopIndex=0; uiLoopIndex < 1; uiLoopIndex++)
1537                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8Protocol      : 0x%X ",
1538                         psfCSType->cCPacketClassificationRule.u8Protocol);
1539
1540                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPMaskedSourceAddressLength    :0x%X ",
1541                         psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddressLength);
1542
1543                 for(uiLoopIndex=0; uiLoopIndex < 32; uiLoopIndex++)
1544                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPMaskedSourceAddress[32]:0x%X ",
1545                         psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddress[uiLoopIndex]);
1546
1547                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  "u8IPDestinationAddressLength : 0x%02X ",
1548                         psfCSType->cCPacketClassificationRule.u8IPDestinationAddressLength);
1549
1550                 for(uiLoopIndex=0;uiLoopIndex<32;uiLoopIndex++)
1551                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8IPDestinationAddress[32]:0x%X ",
1552                         psfCSType->cCPacketClassificationRule.u8IPDestinationAddress[uiLoopIndex]);
1553
1554                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8ProtocolSourcePortRangeLength:0x%X ",
1555                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength);
1556
1557                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8ProtocolSourcePortRange[4]:0x%X ,0x%X ,0x%X ,0x%X ",
1558                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[0],
1559                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[1],
1560                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[2],
1561                         psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[3]);
1562
1563                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8ProtocolDestPortRangeLength:0x%X ",
1564                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength);
1565
1566                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8ProtocolDestPortRange[4]:0x%X ,0x%X ,0x%X ,0x%X ",
1567                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[0],
1568                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[1],
1569                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[2],
1570                         psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange[3]);
1571
1572                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8EthernetDestMacAddressLength:0x%X ",
1573                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
1574
1575                 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",
1576                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[0],
1577                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[1],
1578                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[2],
1579                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[3],
1580                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[4],
1581                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddress[5]);
1582
1583                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8EthernetSourceMACAddressLength:0x%X ",
1584                         psfCSType->cCPacketClassificationRule.u8EthernetDestMacAddressLength);
1585
1586                 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",
1587                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[0],
1588                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[1],
1589                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[2],
1590                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[3],
1591                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[4],
1592                         psfCSType->cCPacketClassificationRule.u8EthernetSourceMACAddress[5]);
1593
1594                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8EthertypeLength              :0x%X ",
1595                         psfCSType->cCPacketClassificationRule.u8EthertypeLength);
1596                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8Ethertype[3]                 :0x%X ,0x%X ,0x%X ",
1597                         psfCSType->cCPacketClassificationRule.u8Ethertype[0],
1598                         psfCSType->cCPacketClassificationRule.u8Ethertype[1],
1599                         psfCSType->cCPacketClassificationRule.u8Ethertype[2]);
1600                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16UserPriority                :0x%X ",
1601                         psfCSType->cCPacketClassificationRule.u16UserPriority);
1602                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16VLANID                      :0x%X ",
1603                         psfCSType->cCPacketClassificationRule.u16VLANID);
1604                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8AssociatedPHSI               :0x%X ",
1605                         psfCSType->cCPacketClassificationRule.u8AssociatedPHSI);
1606                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u16PacketClassificationRuleIndex:0x%X ",
1607                         psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex);
1608
1609                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8VendorSpecificClassifierParamLength:0x%X ",
1610                         psfCSType->cCPacketClassificationRule.u8VendorSpecificClassifierParamLength);
1611                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8VendorSpecificClassifierParam[1]:0x%X ",
1612                         psfCSType->cCPacketClassificationRule.u8VendorSpecificClassifierParam[0]);
1613 #ifdef VERSION_D5
1614                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " u8IPv6FlowLableLength                           :0x%X ",
1615                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLableLength);
1616                 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 ",
1617                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[0],
1618                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[1],
1619                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[2],
1620                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[3],
1621                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[4],
1622                         psfCSType->cCPacketClassificationRule.u8IPv6FlowLable[5]);
1623 #endif
1624         }
1625
1626         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL,  " bValid                  : 0x%X",pstAddIndication->sfActiveSet.bValid);
1627
1628 }
1629
1630 static inline ULONG RestoreSFParam(PMINI_ADAPTER Adapter, ULONG ulAddrSFParamSet,PUCHAR pucDestBuffer)
1631 {
1632         UINT  nBytesToRead = sizeof(stServiceFlowParamSI);
1633
1634         if(ulAddrSFParamSet == 0 || NULL == pucDestBuffer)
1635         {
1636                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "Got Param address as 0!!");
1637                 return 0;
1638         }
1639         ulAddrSFParamSet = ntohl(ulAddrSFParamSet);
1640
1641         //Read out the SF Param Set At the indicated Location
1642         if(rdm(Adapter, ulAddrSFParamSet, (PUCHAR)pucDestBuffer, nBytesToRead) < 0)
1643                 return STATUS_FAILURE;
1644
1645         return 1;
1646 }
1647
1648
1649 static ULONG StoreSFParam(PMINI_ADAPTER Adapter,PUCHAR pucSrcBuffer,ULONG  ulAddrSFParamSet)
1650 {
1651     UINT        nBytesToWrite = sizeof(stServiceFlowParamSI);
1652         int ret = 0;
1653
1654         if(ulAddrSFParamSet == 0 || NULL == pucSrcBuffer)
1655         {
1656                 return 0;
1657         }
1658
1659         ret = wrm(Adapter, ulAddrSFParamSet, (u8 *)pucSrcBuffer, nBytesToWrite);
1660         if (ret < 0) {
1661                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "%s:%d WRM failed",__FUNCTION__, __LINE__);
1662                 return ret;
1663         }
1664         return 1;
1665 }
1666
1667 ULONG StoreCmControlResponseMessage(PMINI_ADAPTER Adapter,PVOID pvBuffer,UINT *puBufferLength)
1668 {
1669         stLocalSFAddIndicationAlt *pstAddIndicationAlt = NULL;
1670         stLocalSFAddIndication *  pstAddIndication = NULL;
1671         stLocalSFDeleteRequest *pstDeletionRequest;
1672         UINT uiSearchRuleIndex;
1673         ULONG ulSFID;
1674
1675         pstAddIndicationAlt = (stLocalSFAddIndicationAlt *)(pvBuffer);
1676
1677         /*
1678         *       In case of DSD Req By MS, we should immediately delete this SF so that
1679         *       we can stop the further classifying the pkt for this SF.
1680         */
1681         if(pstAddIndicationAlt->u8Type == DSD_REQ)
1682         {
1683                 pstDeletionRequest = (stLocalSFDeleteRequest *)pvBuffer;
1684
1685                 ulSFID = ntohl(pstDeletionRequest->u32SFID);
1686                 uiSearchRuleIndex=SearchSfid(Adapter,ulSFID);
1687
1688                 if(uiSearchRuleIndex < NO_OF_QUEUES)
1689                 {
1690                         deleteSFBySfid(Adapter,uiSearchRuleIndex);
1691                         Adapter->u32TotalDSD++;
1692                 }
1693                 return 1;
1694         }
1695
1696
1697         if(     (pstAddIndicationAlt->u8Type == DSD_RSP) ||
1698                 (pstAddIndicationAlt->u8Type == DSD_ACK))
1699         {
1700                 //No Special handling send the message as it is
1701                 return 1;
1702         }
1703         // For DSA_REQ, only upto "psfAuthorizedSet" parameter should be accessed by driver!
1704
1705         pstAddIndication=kmalloc(sizeof(*pstAddIndication), GFP_KERNEL);
1706         if(NULL==pstAddIndication)
1707                 return 0;
1708
1709         /* AUTHORIZED SET */
1710         pstAddIndication->psfAuthorizedSet = (stServiceFlowParamSI *)
1711                         GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID);
1712         if(!pstAddIndication->psfAuthorizedSet)
1713                 return 0;
1714
1715         if(StoreSFParam(Adapter,(PUCHAR)&pstAddIndicationAlt->sfAuthorizedSet,
1716                                 (ULONG)pstAddIndication->psfAuthorizedSet)!= 1)
1717                 return 0;
1718
1719         /* this can't possibly be right */
1720         pstAddIndication->psfAuthorizedSet = (stServiceFlowParamSI *)ntohl((ULONG)pstAddIndication->psfAuthorizedSet);
1721
1722         if(pstAddIndicationAlt->u8Type == DSA_REQ)
1723         {
1724                 stLocalSFAddRequest AddRequest;
1725
1726                 AddRequest.u8Type = pstAddIndicationAlt->u8Type;
1727                 AddRequest.eConnectionDir = pstAddIndicationAlt->u8Direction;
1728                 AddRequest.u16TID = pstAddIndicationAlt->u16TID;
1729                 AddRequest.u16CID = pstAddIndicationAlt->u16CID;
1730                 AddRequest.u16VCID = pstAddIndicationAlt->u16VCID;
1731                 AddRequest.psfParameterSet =pstAddIndication->psfAuthorizedSet ;
1732                 (*puBufferLength) = sizeof(stLocalSFAddRequest);
1733                 memcpy(pvBuffer,&AddRequest,sizeof(stLocalSFAddRequest));
1734                 return 1;
1735         }
1736
1737         // Since it's not DSA_REQ, we can access all field in pstAddIndicationAlt
1738
1739         //We need to extract the structure from the buffer and pack it differently
1740
1741         pstAddIndication->u8Type = pstAddIndicationAlt->u8Type;
1742         pstAddIndication->eConnectionDir= pstAddIndicationAlt->u8Direction ;
1743         pstAddIndication->u16TID = pstAddIndicationAlt->u16TID;
1744         pstAddIndication->u16CID = pstAddIndicationAlt->u16CID;
1745         pstAddIndication->u16VCID = pstAddIndicationAlt->u16VCID;
1746         pstAddIndication->u8CC = pstAddIndicationAlt->u8CC;
1747
1748         /* ADMITTED SET */
1749         pstAddIndication->psfAdmittedSet = (stServiceFlowParamSI *)
1750                 GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID);
1751         if(!pstAddIndication->psfAdmittedSet)
1752                 return 0;
1753         if(StoreSFParam(Adapter,(PUCHAR)&pstAddIndicationAlt->sfAdmittedSet,(ULONG)pstAddIndication->psfAdmittedSet) != 1)
1754                 return 0;
1755
1756         pstAddIndication->psfAdmittedSet = (stServiceFlowParamSI *)ntohl((ULONG)pstAddIndication->psfAdmittedSet);
1757
1758
1759         /* ACTIVE SET */
1760         pstAddIndication->psfActiveSet = (stServiceFlowParamSI *)
1761                 GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID);
1762         if(!pstAddIndication->psfActiveSet)
1763                 return 0;
1764         if(StoreSFParam(Adapter,(PUCHAR)&pstAddIndicationAlt->sfActiveSet,(ULONG)pstAddIndication->psfActiveSet) != 1)
1765                 return 0;
1766
1767         pstAddIndication->psfActiveSet = (stServiceFlowParamSI *)ntohl((ULONG)pstAddIndication->psfActiveSet);
1768
1769         (*puBufferLength) = sizeof(stLocalSFAddIndication);
1770         *(stLocalSFAddIndication *)pvBuffer = *pstAddIndication;
1771         kfree(pstAddIndication);
1772         return 1;
1773 }
1774
1775
1776 static inline stLocalSFAddIndicationAlt
1777 *RestoreCmControlResponseMessage(register PMINI_ADAPTER Adapter,register PVOID pvBuffer)
1778 {
1779         ULONG ulStatus=0;
1780         stLocalSFAddIndication *pstAddIndication = NULL;
1781         stLocalSFAddIndicationAlt *pstAddIndicationDest = NULL;
1782         pstAddIndication = (stLocalSFAddIndication *)(pvBuffer);
1783
1784         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "=====>" );
1785         if ((pstAddIndication->u8Type == DSD_REQ) ||
1786                 (pstAddIndication->u8Type == DSD_RSP) ||
1787                 (pstAddIndication->u8Type == DSD_ACK))
1788         {
1789                 return (stLocalSFAddIndicationAlt *)pvBuffer;
1790         }
1791
1792         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Inside RestoreCmControlResponseMessage ");
1793         /*
1794         //Need to Allocate memory to contain the SUPER Large structures
1795         //Our driver cant create these structures on Stack :(
1796         */
1797         pstAddIndicationDest=kmalloc(sizeof(stLocalSFAddIndicationAlt), GFP_KERNEL);
1798
1799         if(pstAddIndicationDest)
1800         {
1801                 memset(pstAddIndicationDest,0,sizeof(stLocalSFAddIndicationAlt));
1802         }
1803         else
1804         {
1805                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Failed to allocate memory for SF Add Indication Structure ");
1806                 return NULL;
1807         }
1808         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "AddIndication-u8Type : 0x%X",pstAddIndication->u8Type);
1809         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "AddIndication-u8Direction : 0x%X",pstAddIndication->eConnectionDir);
1810         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "AddIndication-u8TID : 0x%X",ntohs(pstAddIndication->u16TID));
1811         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "AddIndication-u8CID : 0x%X",ntohs(pstAddIndication->u16CID));
1812         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "AddIndication-u16VCID : 0x%X",ntohs(pstAddIndication->u16VCID));
1813         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "AddIndication-autorized set loc : %p",pstAddIndication->psfAuthorizedSet);
1814         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "AddIndication-admitted set loc : %p",pstAddIndication->psfAdmittedSet);
1815         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "AddIndication-Active set loc : %p",pstAddIndication->psfActiveSet);
1816
1817         pstAddIndicationDest->u8Type = pstAddIndication->u8Type;
1818         pstAddIndicationDest->u8Direction = pstAddIndication->eConnectionDir;
1819         pstAddIndicationDest->u16TID = pstAddIndication->u16TID;
1820         pstAddIndicationDest->u16CID = pstAddIndication->u16CID;
1821         pstAddIndicationDest->u16VCID = pstAddIndication->u16VCID;
1822         pstAddIndicationDest->u8CC = pstAddIndication->u8CC;
1823
1824         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "Restoring Active Set ");
1825         ulStatus=RestoreSFParam(Adapter,(ULONG)pstAddIndication->psfActiveSet, (PUCHAR)&pstAddIndicationDest->sfActiveSet);
1826         if(ulStatus != 1)
1827         {
1828                 goto failed_restore_sf_param;
1829         }
1830         if(pstAddIndicationDest->sfActiveSet.u8TotalClassifiers > MAX_CLASSIFIERS_IN_SF)
1831                 pstAddIndicationDest->sfActiveSet.u8TotalClassifiers = MAX_CLASSIFIERS_IN_SF;
1832
1833         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "Restoring Admitted Set ");
1834         ulStatus=RestoreSFParam(Adapter,(ULONG)pstAddIndication->psfAdmittedSet,(PUCHAR)&pstAddIndicationDest->sfAdmittedSet);
1835         if(ulStatus != 1)
1836         {
1837                 goto failed_restore_sf_param;
1838         }
1839         if(pstAddIndicationDest->sfAdmittedSet.u8TotalClassifiers > MAX_CLASSIFIERS_IN_SF)
1840                 pstAddIndicationDest->sfAdmittedSet.u8TotalClassifiers = MAX_CLASSIFIERS_IN_SF;
1841
1842         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "Restoring Authorized Set ");
1843         ulStatus=RestoreSFParam(Adapter,(ULONG)pstAddIndication->psfAuthorizedSet,(PUCHAR)&pstAddIndicationDest->sfAuthorizedSet);
1844         if(ulStatus != 1)
1845         {
1846                 goto failed_restore_sf_param;
1847         }
1848         if(pstAddIndicationDest->sfAuthorizedSet.u8TotalClassifiers > MAX_CLASSIFIERS_IN_SF)
1849                 pstAddIndicationDest->sfAuthorizedSet.u8TotalClassifiers = MAX_CLASSIFIERS_IN_SF;
1850
1851         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Dumping the whole raw packet");
1852         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "============================================================");
1853         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, " pstAddIndicationDest->sfActiveSet size  %zx %p", sizeof(*pstAddIndicationDest), pstAddIndicationDest);
1854         //BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, (unsigned char *)pstAddIndicationDest, sizeof(*pstAddIndicationDest));
1855         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "============================================================");
1856         return pstAddIndicationDest;
1857 failed_restore_sf_param:
1858         kfree(pstAddIndicationDest);
1859         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<=====" );
1860         return NULL;
1861 }
1862
1863 ULONG SetUpTargetDsxBuffers(PMINI_ADAPTER Adapter)
1864 {
1865         ULONG ulTargetDsxBuffersBase = 0;
1866         ULONG ulCntTargetBuffers;
1867         ULONG ulIndex=0;
1868         int Status;
1869
1870         if (!Adapter) {
1871                 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Adapter was NULL!!!");
1872                 return 0;
1873         }
1874
1875         if(Adapter->astTargetDsxBuffer[0].ulTargetDsxBuffer)
1876                 return 1;
1877
1878         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Size of Each DSX Buffer(Also size of ServiceFlowParamSI): %zx ",sizeof(stServiceFlowParamSI));
1879         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Reading DSX buffer From Target location %x ",DSX_MESSAGE_EXCHANGE_BUFFER);
1880
1881         Status = rdmalt(Adapter, DSX_MESSAGE_EXCHANGE_BUFFER,
1882                                         (PUINT)&ulTargetDsxBuffersBase, sizeof(UINT));
1883         if(Status < 0)
1884         {
1885                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "RDM failed!!");
1886                 return 0;
1887         }
1888
1889         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Base Address Of DSX  Target Buffer : 0x%lx",ulTargetDsxBuffersBase);
1890
1891         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "Tgt Buffer is Now %lx :",ulTargetDsxBuffersBase);
1892
1893         ulCntTargetBuffers = DSX_MESSAGE_EXCHANGE_BUFFER_SIZE/sizeof(stServiceFlowParamSI);
1894
1895         Adapter->ulTotalTargetBuffersAvailable =
1896                 ulCntTargetBuffers > MAX_TARGET_DSX_BUFFERS ?
1897                 MAX_TARGET_DSX_BUFFERS : ulCntTargetBuffers;
1898
1899         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, " Total Target DSX Buffer setup %lx ",Adapter->ulTotalTargetBuffersAvailable);
1900
1901         for(ulIndex=0; ulIndex < Adapter->ulTotalTargetBuffersAvailable ; ulIndex++)
1902         {
1903                 Adapter->astTargetDsxBuffer[ulIndex].ulTargetDsxBuffer = ulTargetDsxBuffersBase;
1904                 Adapter->astTargetDsxBuffer[ulIndex].valid=1;
1905                 Adapter->astTargetDsxBuffer[ulIndex].tid=0;
1906                 ulTargetDsxBuffersBase+=sizeof(stServiceFlowParamSI);
1907                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "  Target DSX Buffer %lx setup at 0x%lx",
1908                         ulIndex, Adapter->astTargetDsxBuffer[ulIndex].ulTargetDsxBuffer);
1909         }
1910         Adapter->ulCurrentTargetBuffer = 0;
1911         Adapter->ulFreeTargetBufferCnt = Adapter->ulTotalTargetBuffersAvailable;
1912         return 1;
1913 }
1914
1915 static ULONG GetNextTargetBufferLocation(PMINI_ADAPTER Adapter,B_UINT16 tid)
1916 {
1917         ULONG  ulTargetDSXBufferAddress;
1918         ULONG  ulTargetDsxBufferIndexToUse,ulMaxTry;
1919
1920         if((Adapter->ulTotalTargetBuffersAvailable == 0)||
1921                         (Adapter->ulFreeTargetBufferCnt == 0))
1922         {
1923         ClearTargetDSXBuffer(Adapter,tid,FALSE);
1924                 return 0;
1925         }
1926
1927     ulTargetDsxBufferIndexToUse = Adapter->ulCurrentTargetBuffer;
1928     ulMaxTry = Adapter->ulTotalTargetBuffersAvailable;
1929         while((ulMaxTry)&&(Adapter->astTargetDsxBuffer[ulTargetDsxBufferIndexToUse].valid != 1))
1930         {
1931                  ulTargetDsxBufferIndexToUse = (ulTargetDsxBufferIndexToUse+1)%
1932                                         Adapter->ulTotalTargetBuffersAvailable;
1933                  ulMaxTry--;
1934         }
1935
1936         if(ulMaxTry==0)
1937         {
1938                 BCM_DEBUG_PRINT (Adapter, DBG_TYPE_PRINTK, 0, 0, "\n GetNextTargetBufferLocation : Error No Free Target DSX Buffers FreeCnt : %lx ",Adapter->ulFreeTargetBufferCnt);
1939                 ClearTargetDSXBuffer(Adapter,tid,FALSE);
1940                 return 0;
1941         }
1942
1943
1944         ulTargetDSXBufferAddress =
1945                 Adapter->astTargetDsxBuffer[ulTargetDsxBufferIndexToUse].ulTargetDsxBuffer;
1946         Adapter->astTargetDsxBuffer[ulTargetDsxBufferIndexToUse].valid=0;
1947         Adapter->astTargetDsxBuffer[ulTargetDsxBufferIndexToUse].tid=tid;
1948         Adapter->ulFreeTargetBufferCnt--;
1949
1950
1951         ulTargetDsxBufferIndexToUse =
1952                 (ulTargetDsxBufferIndexToUse+1)%Adapter->ulTotalTargetBuffersAvailable;
1953         Adapter->ulCurrentTargetBuffer = ulTargetDsxBufferIndexToUse;
1954         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "GetNextTargetBufferLocation :Returning address %lx tid %d\n",
1955                 ulTargetDSXBufferAddress,tid);
1956         return ulTargetDSXBufferAddress;
1957 }
1958
1959
1960 INT AllocAdapterDsxBuffer(PMINI_ADAPTER Adapter)
1961 {
1962         /*
1963         //Need to Allocate memory to contain the SUPER Large structures
1964         //Our driver cant create these structures on Stack
1965         */
1966         Adapter->caDsxReqResp=kmalloc(sizeof(stLocalSFAddIndicationAlt)+LEADER_SIZE, GFP_KERNEL);
1967         if(!Adapter->caDsxReqResp)
1968                 return -ENOMEM;
1969         return 0;
1970 }
1971
1972 INT FreeAdapterDsxBuffer(PMINI_ADAPTER Adapter)
1973 {
1974         if(Adapter->caDsxReqResp)
1975         {
1976                 kfree(Adapter->caDsxReqResp);
1977         }
1978         return 0;
1979
1980 }
1981 /**
1982 @ingroup ctrl_pkt_functions
1983 This routinue would process the Control responses
1984 for the Connection Management.
1985 @return   - Queue index for the free SFID else returns Invalid Index.
1986 */
1987 BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter,  /**<Pointer to the Adapter structure*/
1988                                                                                         PVOID pvBuffer /**Starting Address of the Buffer, that contains the AddIndication Data*/
1989                                                                                         )
1990 {
1991         stServiceFlowParamSI                    *psfLocalSet=NULL;
1992         stLocalSFAddIndicationAlt               *pstAddIndication = NULL;
1993         stLocalSFChangeIndicationAlt    *pstChangeIndication = NULL;
1994         PLEADER                                                 pLeader=NULL;
1995         /*
1996         //Otherwise the message contains a target address from where we need to
1997         //read out the rest of the service flow param structure
1998         */
1999         if((pstAddIndication = RestoreCmControlResponseMessage(Adapter,pvBuffer))
2000                         == NULL)
2001         {
2002                 ClearTargetDSXBuffer(Adapter,((stLocalSFAddIndication *)pvBuffer)->u16TID, FALSE);
2003                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_PRINTK, 0, 0, "Error in restoring Service Flow param structure from DSx message");
2004                 return FALSE;
2005         }
2006
2007         DumpCmControlPacket(pstAddIndication);
2008         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "====>");
2009         pLeader = (PLEADER)Adapter->caDsxReqResp;
2010
2011         pLeader->Status =CM_CONTROL_NEWDSX_MULTICLASSIFIER_REQ;
2012         pLeader->Vcid = 0;
2013
2014         ClearTargetDSXBuffer(Adapter,pstAddIndication->u16TID,FALSE);
2015     BCM_DEBUG_PRINT (Adapter, DBG_TYPE_PRINTK, 0, 0, "### TID RECEIVED %d\n",pstAddIndication->u16TID);
2016         switch(pstAddIndication->u8Type)
2017         {
2018                 case DSA_REQ:
2019                 {
2020                         pLeader->PLength = sizeof(stLocalSFAddIndicationAlt);
2021                         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Sending DSA Response....\n");
2022                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  "SENDING DSA RESPONSE TO MAC %d", pLeader->PLength );
2023                         *((stLocalSFAddIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE]))
2024                                                 = *pstAddIndication;
2025                         ((stLocalSFAddIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE]))->u8Type = DSA_RSP;
2026
2027                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,  " VCID = %x", ntohs(pstAddIndication->u16VCID));
2028                         CopyBufferToControlPacket(Adapter,(PVOID)Adapter->caDsxReqResp);
2029                         kfree(pstAddIndication);
2030                 }
2031                 break;
2032                 case DSA_RSP:
2033                 {
2034                         pLeader->PLength = sizeof(stLocalSFAddIndicationAlt);
2035                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SENDING DSA ACK TO MAC %d",
2036                                 pLeader->PLength);
2037                         *((stLocalSFAddIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE]))
2038                                                 = *pstAddIndication;
2039                         ((stLocalSFAddIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE]))->u8Type = DSA_ACK;
2040
2041                 }//no break here..we should go down.
2042                 case DSA_ACK:
2043                 {
2044                         UINT uiSearchRuleIndex=0;
2045
2046                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "VCID:0x%X",
2047                                 ntohs(pstAddIndication->u16VCID));
2048             uiSearchRuleIndex=SearchFreeSfid(Adapter);
2049             BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"uiSearchRuleIndex:0x%X ",
2050                                 uiSearchRuleIndex);
2051                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Direction:0x%X ",
2052                                 pstAddIndication->u8Direction);
2053                         if((uiSearchRuleIndex< NO_OF_QUEUES) )
2054                         {
2055                                 Adapter->PackInfo[uiSearchRuleIndex].ucDirection =
2056                                         pstAddIndication->u8Direction;
2057                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "bValid:0x%X ",
2058                                         pstAddIndication->sfActiveSet.bValid);
2059                                 if(pstAddIndication->sfActiveSet.bValid==TRUE)
2060                                 {
2061                                         Adapter->PackInfo[uiSearchRuleIndex].bActiveSet=TRUE;
2062                                 }
2063                                 if(pstAddIndication->sfAuthorizedSet.bValid==TRUE)
2064                                 {
2065                                         Adapter->PackInfo[uiSearchRuleIndex].bAuthorizedSet=TRUE;
2066                                 }
2067                                 if(pstAddIndication->sfAdmittedSet.bValid==TRUE)
2068                                 {
2069                                         Adapter->PackInfo[uiSearchRuleIndex].bAdmittedSet=TRUE;
2070                                 }
2071                                 if(FALSE == pstAddIndication->sfActiveSet.bValid)
2072                                 {
2073                                         Adapter->PackInfo[uiSearchRuleIndex].bActive = FALSE;
2074                                         Adapter->PackInfo[uiSearchRuleIndex].bActivateRequestSent = FALSE;
2075                                         if(pstAddIndication->sfAdmittedSet.bValid)
2076                                         {
2077                                                 psfLocalSet = &pstAddIndication->sfAdmittedSet;
2078                                         }
2079                                         else if(pstAddIndication->sfAuthorizedSet.bValid)
2080                                         {
2081                                                 psfLocalSet = &pstAddIndication->sfAuthorizedSet;
2082                                         }
2083                                 }
2084                                 else
2085                                 {
2086                                         psfLocalSet = &pstAddIndication->sfActiveSet;
2087                                         Adapter->PackInfo[uiSearchRuleIndex].bActive=TRUE;
2088                                 }
2089
2090                                 if(!psfLocalSet)
2091                                 {
2092                                         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "No set is valid\n");
2093                                         Adapter->PackInfo[uiSearchRuleIndex].bActive=FALSE;
2094                     Adapter->PackInfo[uiSearchRuleIndex].bValid=FALSE;
2095                                         Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value=0;
2096                                         kfree(pstAddIndication);
2097                                 }
2098
2099                                 else if(psfLocalSet->bValid && (pstAddIndication->u8CC == 0))
2100                                 {
2101                                         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "DSA ACK");
2102                                         Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value =
2103                                                 ntohs(pstAddIndication->u16VCID);
2104                                         Adapter->PackInfo[uiSearchRuleIndex].usCID =
2105                                                 ntohs(pstAddIndication->u16CID);
2106
2107                                         if(UPLINK_DIR == pstAddIndication->u8Direction)
2108                                                 atomic_set(&Adapter->PackInfo[uiSearchRuleIndex].uiPerSFTxResourceCount, DEFAULT_PERSFCOUNT);
2109                                         CopyToAdapter(Adapter,psfLocalSet,uiSearchRuleIndex,
2110                                                                 DSA_ACK, pstAddIndication);
2111                                         // don't free pstAddIndication
2112
2113                                         /* Inside CopyToAdapter, Sorting of all the SFs take place.
2114                                             Hence any access to the newly added SF through uiSearchRuleIndex is invalid.
2115                                             SHOULD BE STRICTLY AVOIDED.
2116                                         */
2117 //                                      *(PULONG)(((PUCHAR)pvBuffer)+1)=psfLocalSet->u32SFID;
2118                                         memcpy((((PUCHAR)pvBuffer)+1), &psfLocalSet->u32SFID, 4);
2119
2120                                         if(pstAddIndication->sfActiveSet.bValid == TRUE)
2121                                         {
2122                                                 if(UPLINK_DIR == pstAddIndication->u8Direction)
2123                                                 {
2124                                                         if(!Adapter->LinkUpStatus)
2125                                                         {
2126                                                                 netif_carrier_on(Adapter->dev);
2127                                                                 netif_start_queue(Adapter->dev);
2128                                                                 Adapter->LinkUpStatus = 1;
2129                                                                 if (netif_msg_link(Adapter))
2130                                                                         pr_info(PFX "%s: link up\n", Adapter->dev->name);
2131                                                                 atomic_set(&Adapter->TxPktAvail, 1);
2132                                                                 wake_up(&Adapter->tx_packet_wait_queue);
2133                                                                 Adapter->liTimeSinceLastNetEntry = get_seconds();
2134                                                         }
2135                                                 }
2136                                         }
2137                                 }
2138
2139                                 else
2140                                 {
2141                                         Adapter->PackInfo[uiSearchRuleIndex].bActive=FALSE;
2142                     Adapter->PackInfo[uiSearchRuleIndex].bValid=FALSE;
2143                                         Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value=0;
2144                                         kfree(pstAddIndication);
2145                                 }
2146                         }
2147                         else
2148                         {
2149                                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_PRINTK, 0, 0, "DSA ACK did not get valid SFID");
2150                                 kfree(pstAddIndication);
2151                                 return FALSE;
2152                         }
2153                 }
2154                 break;
2155                 case DSC_REQ:
2156                 {
2157                         pLeader->PLength = sizeof(stLocalSFChangeIndicationAlt);
2158                         pstChangeIndication     = (stLocalSFChangeIndicationAlt*)pstAddIndication;
2159                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SENDING DSC RESPONSE TO MAC %d", pLeader->PLength);
2160
2161                         *((stLocalSFChangeIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE])) = *pstChangeIndication;
2162                         ((stLocalSFChangeIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE]))->u8Type = DSC_RSP;
2163
2164                         CopyBufferToControlPacket(Adapter,(PVOID)Adapter->caDsxReqResp);
2165                         kfree(pstAddIndication);
2166                 }
2167                 break;
2168                 case DSC_RSP:
2169                 {
2170                         pLeader->PLength = sizeof(stLocalSFChangeIndicationAlt);
2171                         pstChangeIndication     = (stLocalSFChangeIndicationAlt*)pstAddIndication;
2172                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SENDING DSC ACK TO MAC %d", pLeader->PLength);
2173                         *((stLocalSFChangeIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE])) = *pstChangeIndication;
2174                         ((stLocalSFChangeIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE]))->u8Type = DSC_ACK;
2175                 }
2176                 case DSC_ACK:
2177                 {
2178                         UINT uiSearchRuleIndex=0;
2179
2180                         pstChangeIndication = (stLocalSFChangeIndicationAlt *)pstAddIndication;
2181                         uiSearchRuleIndex=SearchSfid(Adapter,ntohl(pstChangeIndication->sfActiveSet.u32SFID));
2182                         if(uiSearchRuleIndex > NO_OF_QUEUES-1)
2183                         {
2184                                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_PRINTK, 0, 0, "SF doesn't exist for which DSC_ACK is received");
2185                         }
2186                         if((uiSearchRuleIndex < NO_OF_QUEUES))
2187                         {
2188                                 Adapter->PackInfo[uiSearchRuleIndex].ucDirection = pstChangeIndication->u8Direction;
2189                                 if(pstChangeIndication->sfActiveSet.bValid==TRUE)
2190                                 {
2191                                         Adapter->PackInfo[uiSearchRuleIndex].bActiveSet=TRUE;
2192                                 }
2193                                 if(pstChangeIndication->sfAuthorizedSet.bValid==TRUE)
2194                                 {
2195                                         Adapter->PackInfo[uiSearchRuleIndex].bAuthorizedSet=TRUE;
2196                                 }
2197                                 if(pstChangeIndication->sfAdmittedSet.bValid==TRUE)
2198                                 {
2199                                         Adapter->PackInfo[uiSearchRuleIndex].bAdmittedSet=TRUE;
2200                                 }
2201
2202                                 if(FALSE==pstChangeIndication->sfActiveSet.bValid)
2203                                 {
2204                                         Adapter->PackInfo[uiSearchRuleIndex].bActive = FALSE;
2205                                         Adapter->PackInfo[uiSearchRuleIndex].bActivateRequestSent = FALSE;
2206                                         if(pstChangeIndication->sfAdmittedSet.bValid)
2207                                         {
2208                                                 psfLocalSet = &pstChangeIndication->sfAdmittedSet;
2209                                         }
2210                                         else if(pstChangeIndication->sfAuthorizedSet.bValid)
2211                                         {
2212                                                 psfLocalSet = &pstChangeIndication->sfAuthorizedSet;
2213                                         }
2214                                 }
2215
2216                                 else
2217                                 {
2218                                         psfLocalSet = &pstChangeIndication->sfActiveSet;
2219                                         Adapter->PackInfo[uiSearchRuleIndex].bActive=TRUE;
2220                                 }
2221                                 if(psfLocalSet->bValid && (pstChangeIndication->u8CC == 0))
2222                                 {
2223                                         Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value =
2224                                                 ntohs(pstChangeIndication->u16VCID);
2225                                         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "CC field is %d bvalid = %d\n",
2226                                                         pstChangeIndication->u8CC, psfLocalSet->bValid);
2227                                         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "VCID= %d\n", ntohs(pstChangeIndication->u16VCID));
2228                                         Adapter->PackInfo[uiSearchRuleIndex].usCID =
2229                                                 ntohs(pstChangeIndication->u16CID);
2230                                         CopyToAdapter(Adapter,psfLocalSet,uiSearchRuleIndex,
2231                                                                 DSC_ACK, pstAddIndication);
2232
2233                                         *(PULONG)(((PUCHAR)pvBuffer)+1)=psfLocalSet->u32SFID;
2234                                 }
2235                                 else if(pstChangeIndication->u8CC == 6)
2236                                 {
2237                                         deleteSFBySfid(Adapter,uiSearchRuleIndex);
2238                                         kfree(pstAddIndication);
2239                                 }
2240                         }
2241                         else
2242                         {
2243                                 BCM_DEBUG_PRINT( Adapter,DBG_TYPE_PRINTK, 0, 0, "DSC ACK did not get valid SFID");
2244                                 kfree(pstAddIndication);
2245                                 return FALSE;
2246                         }
2247                 }
2248                 break;
2249                 case DSD_REQ:
2250                 {
2251                         UINT uiSearchRuleIndex;
2252                         ULONG ulSFID;
2253
2254                         pLeader->PLength = sizeof(stLocalSFDeleteIndication);
2255                         *((stLocalSFDeleteIndication*)&(Adapter->caDsxReqResp[LEADER_SIZE])) = *((stLocalSFDeleteIndication*)pstAddIndication);
2256
2257                         ulSFID = ntohl(((stLocalSFDeleteIndication*)pstAddIndication)->u32SFID);
2258                         uiSearchRuleIndex=SearchSfid(Adapter,ulSFID);
2259                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "DSD - Removing connection %x",uiSearchRuleIndex);
2260
2261                         if(uiSearchRuleIndex < NO_OF_QUEUES)
2262                         {
2263                                 //Delete All Classifiers Associated with this SFID
2264                                 deleteSFBySfid(Adapter,uiSearchRuleIndex);
2265                                 Adapter->u32TotalDSD++;
2266                         }
2267
2268                         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SENDING DSD RESPONSE TO MAC");
2269                         ((stLocalSFDeleteIndication*)&(Adapter->caDsxReqResp[LEADER_SIZE]))->u8Type = DSD_RSP;
2270                         CopyBufferToControlPacket(Adapter,(PVOID)Adapter->caDsxReqResp);
2271                 }
2272                 case DSD_RSP:
2273                 {
2274                         //Do nothing as SF has already got Deleted
2275                 }
2276                 break;
2277         case DSD_ACK:
2278                         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "DSD ACK Rcd, let App handle it\n");
2279                         break;
2280         default:
2281                 kfree(pstAddIndication);
2282                 return FALSE ;
2283         }
2284         return TRUE;
2285 }
2286
2287 int get_dsx_sf_data_to_application(PMINI_ADAPTER Adapter, UINT uiSFId, void __user *user_buffer)
2288 {
2289         int status = 0;
2290         struct _packet_info *psSfInfo=NULL;
2291         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "status =%d",status);
2292         status = SearchSfid(Adapter, uiSFId);
2293         if (status >= NO_OF_QUEUES) {
2294                 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SFID %d not present in queue !!!", uiSFId );
2295                 return -EINVAL;
2296         }
2297         BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "status =%d",status);
2298         psSfInfo=&Adapter->PackInfo[status];
2299         if(psSfInfo->pstSFIndication && copy_to_user(user_buffer,
2300                 psSfInfo->pstSFIndication, sizeof(stLocalSFAddIndicationAlt)))
2301         {
2302                 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "copy to user failed SFID %d, present in queue !!!", uiSFId );
2303                 status = -EFAULT;
2304                 return status;
2305         }
2306         return STATUS_SUCCESS;
2307 }
2308
2309 VOID OverrideServiceFlowParams(PMINI_ADAPTER Adapter,PUINT puiBuffer)
2310 {
2311         B_UINT32 u32NumofSFsinMsg    = ntohl(*(puiBuffer + 1));
2312         stIM_SFHostNotify *pHostInfo = NULL;
2313         UINT uiSearchRuleIndex       = 0;
2314         ULONG ulSFID                 = 0;
2315
2316         puiBuffer+=2;
2317
2318         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "u32NumofSFsinMsg: 0x%x\n",u32NumofSFsinMsg);
2319
2320         while(u32NumofSFsinMsg != 0 && u32NumofSFsinMsg < NO_OF_QUEUES)
2321         {
2322                 u32NumofSFsinMsg--;
2323                 pHostInfo = (stIM_SFHostNotify *)puiBuffer;
2324                 puiBuffer = (PUINT)(pHostInfo + 1);
2325
2326                 ulSFID = ntohl(pHostInfo->SFID);
2327                 uiSearchRuleIndex=SearchSfid(Adapter,ulSFID);
2328                 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"SFID: 0x%lx\n",ulSFID);
2329
2330                 if(uiSearchRuleIndex >= NO_OF_QUEUES || uiSearchRuleIndex == HiPriority)
2331                 {
2332                         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);
2333                         continue;
2334                 }
2335
2336                 if(pHostInfo->RetainSF == FALSE)
2337                 {
2338                         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"Going to Delete SF");
2339                         deleteSFBySfid(Adapter,uiSearchRuleIndex);
2340                 }
2341                 else
2342                 {
2343
2344                         Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value = ntohs(pHostInfo->VCID);
2345                         Adapter->PackInfo[uiSearchRuleIndex].usCID = ntohs(pHostInfo->newCID);
2346                         Adapter->PackInfo[uiSearchRuleIndex].bActive=FALSE;
2347
2348                         BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL,"pHostInfo->QoSParamSet: 0x%x\n",pHostInfo->QoSParamSet);
2349
2350                         if(pHostInfo->QoSParamSet & 0x1)
2351                                 Adapter->PackInfo[uiSearchRuleIndex].bAuthorizedSet =TRUE;
2352                         if(pHostInfo->QoSParamSet & 0x2)
2353                                 Adapter->PackInfo[uiSearchRuleIndex].bAdmittedSet =TRUE;
2354                         if(pHostInfo->QoSParamSet & 0x4)
2355                         {
2356                                 Adapter->PackInfo[uiSearchRuleIndex].bActiveSet =TRUE;
2357                                 Adapter->PackInfo[uiSearchRuleIndex].bActive=TRUE;
2358                         }
2359                 }
2360         }
2361 }
2362
2363
2364